Move post code chunks to Gists
Also, remove highlight specific things from style.sass
This commit is contained in:
parent
32fac1feae
commit
2f61b11a5a
@ -17,14 +17,6 @@ hosting the page yet. Until we get it in our hands, I did a trick.
|
|||||||
I enabled `mod_rewrite`, `mod_proxy` and `mod_proxy_http`, then added the following
|
I enabled `mod_rewrite`, `mod_proxy` and `mod_proxy_http`, then added the following
|
||||||
lines to my apache config:
|
lines to my apache config:
|
||||||
|
|
||||||
{% highlight apache %}
|
{% gist gergelypolonkai/47680bfa44eb29708f20 %}
|
||||||
RewriteEngine on
|
|
||||||
RewriteRule ^/$ http://172.16.72.131:8080/ [QSA,L,P]
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
|
||||||
RewriteRule ^/(.*) http://172.16.72.131:8080/$1 [QSA,L,P]
|
|
||||||
|
|
||||||
Order allow,deny
|
|
||||||
Allow from all
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
I’m not totally sure it’s actually secure, but it works for now.
|
I’m not totally sure it’s actually secure, but it works for now.
|
||||||
|
@ -24,9 +24,7 @@ own role hierarchy service that implements `RoleHierarchyInterface`.
|
|||||||
So far so good, first tests. It soon turned out that if `User::getRoles()`
|
So far so good, first tests. It soon turned out that if `User::getRoles()`
|
||||||
returns a `DoctrineCollection` as it does by default, then the standard
|
returns a `DoctrineCollection` as it does by default, then the standard
|
||||||
|
|
||||||
{% highlight php %}
|
{% gist gergelypolonkai/883ace4f35e440f6fe0f WhatEver.php %}
|
||||||
$this->get('security.context')->isGranted('ROLE_ADMIN');
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
doesn’t work. I know, it should not be hard coded, as my roles and permission
|
doesn’t work. I know, it should not be hard coded, as my roles and permission
|
||||||
tables are dynamic, I have just tested. So I fixed my `User` entity so
|
tables are dynamic, I have just tested. So I fixed my `User` entity so
|
||||||
@ -37,24 +35,12 @@ return the original collection, but I think it will never be used.
|
|||||||
After that, I had to implement some more features so I put this task away.
|
After that, I had to implement some more features so I put this task away.
|
||||||
Then, I tried to create my first ACL.
|
Then, I tried to create my first ACL.
|
||||||
|
|
||||||
{% highlight php %}
|
{% gist gergelypolonkai/883ace4f35e440f6fe0f WhatEver2.php %}
|
||||||
$securityIdentity = new RoleSecurityIdentity('ROLE_ADMIN');
|
|
||||||
$objectIdentity = new ObjectIdentity('newsClass', 'Acme\\DemoBundle\\Entity\\News');
|
|
||||||
$acl = $aclProvider->createAcl($objectIdentity);
|
|
||||||
|
|
||||||
$acl->insertClassAce($securityIdentity, MaskBuilder::MASK_OWNER);
|
|
||||||
$aclProvider->updateAcl($acl);
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
I was about to check if the user who is logged in has an `OWNER` permission on
|
I was about to check if the user who is logged in has an `OWNER` permission on
|
||||||
the `User` class.
|
the `User` class.
|
||||||
|
|
||||||
{% highlight php %}
|
{% gist gergelypolonkai/883ace4f35e440f6fe0f WhatEver3.php %}
|
||||||
$this->objectIdentity = new ObjectIdentity(self::OBJECT_ID, self::OBJECT_FQCN);
|
|
||||||
if ($this->securityContext->isGranted('OWNER', $this->objectIdentity) === false) {
|
|
||||||
throw new AccessDeniedException('You don’t have the required permissions!');
|
|
||||||
}
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
The ACL was defined based on a role, so everyone who had the `ROLE_ADMIN` role
|
The ACL was defined based on a role, so everyone who had the `ROLE_ADMIN` role
|
||||||
should gain access to the user listing page. But they didn’t. It took several
|
should gain access to the user listing page. But they didn’t. It took several
|
||||||
|
@ -17,10 +17,4 @@ the same name.
|
|||||||
|
|
||||||
To change this, you will have to modify the `config.yml` file like this:
|
To change this, you will have to modify the `config.yml` file like this:
|
||||||
|
|
||||||
{% highlight yaml %}
|
{% gist gergelypolonkai/c695670ecca2809f7c93 %}
|
||||||
session:
|
|
||||||
name: SiteSpecificSessionName
|
|
||||||
lifetime: 3600
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
I hope it helps some of you.
|
|
@ -13,44 +13,10 @@ author:
|
|||||||
Few days ago I have struggled with a problem using Symfony2 configuration. I
|
Few days ago I have struggled with a problem using Symfony2 configuration. I
|
||||||
wanted to add the following kind of configuration to `config.yml`:
|
wanted to add the following kind of configuration to `config.yml`:
|
||||||
|
|
||||||
{% highlight yaml %}
|
{% gist gergelypolonkai/30440e25f7a447730064 config.yml %}
|
||||||
acme_demo:
|
|
||||||
transitions:
|
|
||||||
- { hc_cba: 180 }
|
|
||||||
- { cba_hc: -1 }
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
The problem was that the stuff under `transitions` is dynamic, so those
|
The problem was that the stuff under `transitions` is dynamic, so those
|
||||||
`hc_cba` and `cba_hc` tags can be pretty much anything. After hitting many
|
`hc_cba` and `cba_hc` tags can be pretty much anything. After hitting many
|
||||||
errors, I came to the solution:
|
errors, I came to the solution:
|
||||||
|
|
||||||
{% highlight php %}
|
{% gist gergelypolonkai/30440e25f7a447730064 DynarrayConfiguration.php %}
|
||||||
<?php
|
|
||||||
$rootNode
|
|
||||||
->children()
|
|
||||||
->arrayNode('state_machine')
|
|
||||||
->requiresAtLeastOneElement()
|
|
||||||
->beforeNormalization()
|
|
||||||
->ifArray()
|
|
||||||
->then(function($values) {
|
|
||||||
$ret = array();
|
|
||||||
|
|
||||||
foreach ($values as $value) {
|
|
||||||
foreach ($value as $transition => $time) {
|
|
||||||
$ret[] = array('transition' => $transition, 'time' => e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
})
|
|
||||||
->end()
|
|
||||||
->prototype('array')
|
|
||||||
->children()
|
|
||||||
->scalarNode('transition')->end()
|
|
||||||
->scalarNode('time')->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
->end()
|
|
||||||
;
|
|
||||||
{% endhighlight %}
|
|
||||||
|
@ -20,78 +20,9 @@ feature](https://developer.gnome.org/gobject/unstable/gtype-non-instantiable.htm
|
|||||||
obvious. Making the long story short, I have checked with the `GIO` sources for
|
obvious. Making the long story short, I have checked with the `GIO` sources for
|
||||||
an example, and using that, I have created this small, working chunk:
|
an example, and using that, I have created this small, working chunk:
|
||||||
|
|
||||||
{% highlight c %}
|
{% gist gergelypolonkai/47794b6fb94484f8160b client-state.h %}
|
||||||
#ifndef __WMUD_CLIENT_STATE_H__
|
|
||||||
#define __WMUD_CLIENT_STATE_H__
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
{% gist gergelypolonkai/47794b6fb94484f8160b client-state.c %}
|
||||||
|
|
||||||
/**
|
|
||||||
* WmudClientState:
|
|
||||||
* @WMUD_CLIENT_STATE_FRESH: Client is newly connected. Waiting for a login
|
|
||||||
* player name
|
|
||||||
* @WMUD_CLIENT_STATE_PASSWAIT: Login player name is entered, waiting for a
|
|
||||||
* login password
|
|
||||||
* @WMUD_CLIENT_STATE_MENU: Authentication was successful, player is now in the
|
|
||||||
* main game menu
|
|
||||||
* @WMUD_CLIENT_STATE_INGAME: Character login was successful, player is now
|
|
||||||
* in-game
|
|
||||||
* @WMUD_CLIENT_STATE_YESNO: Player was asked a yes/no question, and we are
|
|
||||||
* waiting for the answer. client.yesNoCallback MUST be set at this point!
|
|
||||||
* TODO: if wmudClient had a prevState field, and there would be some hooks
|
|
||||||
* that are called before and after the client enters a new state, this
|
|
||||||
* could be a three-state stuff, in which the player can enter e.g ? as
|
|
||||||
* the answer, so they would be presented with the question again.
|
|
||||||
* @WMUD_CLIENT_STATE_REGISTERING: Registering a new player. Waiting for the
|
|
||||||
* e-mail address to be given
|
|
||||||
* @WMUD_CLIENT_STATE_REGEMAIL_CONFIRM: E-mail address entered séms valid,
|
|
||||||
* waiting for confirmation
|
|
||||||
*
|
|
||||||
* Game client states.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
WMUD_CLIENT_STATE_FRESH,
|
|
||||||
WMUD_CLIENT_STATE_PASSWAIT,
|
|
||||||
WMUD_CLIENT_STATE_MENU,
|
|
||||||
WMUD_CLIENT_STATE_INGAME,
|
|
||||||
WMUD_CLIENT_STATE_YESNO,
|
|
||||||
WMUD_CLIENT_STATE_REGISTERING,
|
|
||||||
WMUD_CLIENT_STATE_REGEMAIL_CONFIRM
|
|
||||||
} WmudClientState;
|
|
||||||
|
|
||||||
|
|
||||||
GType wmud_client_state_get_type (void) G_GNUC_CONST;
|
|
||||||
#define WMUD_TYPE_CLIENT_STATE (wmud_client_state_get_type())
|
|
||||||
|
|
||||||
#endif /* __WMUD_CLIENT_STATE_H__ */
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
{% highlight c %}
|
|
||||||
#include "wmudclientstate.h"
|
|
||||||
|
|
||||||
GType
|
|
||||||
wmud_client_state_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize g_define_type_id__volatile = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter(&g_define_type_id__volatile)) {
|
|
||||||
static const GEnumValue values[] = {
|
|
||||||
{ WMUD_CLIENT_STATE_FRESH, "WMUD_CLIENT_STATE_FRESH", "fresh" },
|
|
||||||
{ WMUD_CLIENT_STATE_PASSWAIT, "WMUD_CLIENT_STATE_PASSWAIT", "passwait" },
|
|
||||||
{ WMUD_CLIENT_STATE_MENU, "WMUD_CLIENT_STATE_MENU", "menu" },
|
|
||||||
{ WMUD_CLIENT_STATE_INGAME, "WMUD_CLIENT_STATE_INGAME", "ingame" },
|
|
||||||
{ WMUD_CLIENT_STATE_YESNO, "WMUD_CLIENT_STATE_YESNO", "yesno" },
|
|
||||||
{ WMUD_CLIENT_STATE_REGISTERING, "WMUD_CLIENT_STATE_REGISTERING", "registering" },
|
|
||||||
{ WMUD_CLIENT_STATE_REGEMAIL_CONFIRM, "WMUD_CLIENT_STATE_REGEMAIL_CONFIRM", "regemail-confirm" },
|
|
||||||
{ 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
GType g_define_type_id = g_enum_register_static(g_intern_static_string("WmudClientState"), values);
|
|
||||||
g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_define_type_id__volatile;
|
|
||||||
}
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
Still, it can be made more perfect by using the
|
Still, it can be made more perfect by using the
|
||||||
[glib-mkenums](http://developer.gnome.org/gobject/stable/glib-mkenums.html)
|
[glib-mkenums](http://developer.gnome.org/gobject/stable/glib-mkenums.html)
|
||||||
|
@ -14,13 +14,4 @@ Just insert it in your database, feed them two Google coordinates, and you get
|
|||||||
the distance in kilometres. If you happen to need it in miles, change the
|
the distance in kilometres. If you happen to need it in miles, change the
|
||||||
constant `12756.200` in the `RETURN` row to `7922.6` instead.
|
constant `12756.200` in the `RETURN` row to `7922.6` instead.
|
||||||
|
|
||||||
{% highlight sql %}
|
{% gist gergelypolonkai/bdad1cf2d410853bef35 %}
|
||||||
DELIMITER $$
|
|
||||||
|
|
||||||
CREATE FUNCTION `haversine` (lng1 FLOAT, lat1 FLOAT, lng2 FLOAT, lat2 FLOAT)
|
|
||||||
RETURNS float NO SQL DETERMINISTIC
|
|
||||||
BEGIN
|
|
||||||
SET @a = ABS(POWER(SIN(RADIANS(lat1 - lat2)) / 2, 2) + COS(RADIANS(lat1)) * COS(RADIANS(lat2)) * POWER(SIN(RADIANS(lng1 - lng2)) / 2, 2));
|
|
||||||
RETURN 12756.200 * ATAN2(SQRT(@a), SQRT(1 - @a));
|
|
||||||
END$$
|
|
||||||
{% endhighlight %}
|
|
@ -20,38 +20,7 @@ does the work for me. Its only requirements are git (of course), and the
|
|||||||
`column` command, which is pretty obviously present on every POSIX
|
`column` command, which is pretty obviously present on every POSIX
|
||||||
compliant systems (even OSX).
|
compliant systems (even OSX).
|
||||||
|
|
||||||
{% highlight sh %}
|
{% gist gergelypolonkai/8af6a3e86b57dd4c250e %}
|
||||||
#! /bin/sh
|
|
||||||
|
|
||||||
COLUMN=`which column 2> /dev/null`
|
|
||||||
if test -z $COLUMN
|
|
||||||
then
|
|
||||||
echo "`column' is not found in PATH. Cannot continue."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
current_branch=`git rev-parse --abbrev-ref HEAD`
|
|
||||||
|
|
||||||
for branch in $(git for-each-ref --shell --format='%(refname)' refs/heads | sed -e s/^\'refs\\/heads\\///-e s/\'$//)
|
|
||||||
do
|
|
||||||
remote=`git config branch.$branch.remote`
|
|
||||||
merge=`git config branch.$branch.merge | sed -e 's/^refs\/heads\///'`
|
|
||||||
|
|
||||||
[ x"$current_branch" == x"$branch" ] && echo -n '*'
|
|
||||||
|
|
||||||
echo -n "$branch"
|
|
||||||
|
|
||||||
if ! test -z $merge
|
|
||||||
then
|
|
||||||
echo -en "\t"
|
|
||||||
echo -n $remote
|
|
||||||
echo -n /
|
|
||||||
echo -n $merge
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
done | $COLUMN -t
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
I just put it in my path, and `git branches-with-remotes` does the work!
|
I just put it in my path, and `git branches-with-remotes` does the work!
|
||||||
|
|
||||||
|
@ -20,14 +20,7 @@ In my other project,
|
|||||||
method. The following two rules in `Makefile.am` create `gswe-enumtypes.h`
|
method. The following two rules in `Makefile.am` create `gswe-enumtypes.h`
|
||||||
and `gswe-enumtypes.c`.
|
and `gswe-enumtypes.c`.
|
||||||
|
|
||||||
{% highlight make %}
|
{% gist gergelypolonkai/1e2fdedb136de3ca67f0 Makefile %}
|
||||||
gswe-enumtypes.h: $(gswe_enum_headers) gswe-enumtypes.h.template
|
|
||||||
$(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
|
|
||||||
gswe-enumtypes.h.tmp && mv gswe-enumtypes.h.tmp gswe-enumtypes.h
|
|
||||||
gswe-enumtypes.c: $(gswe_enum_headers) gswe-enumtypes.h gswe-enumtypes.c.template
|
|
||||||
$(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \
|
|
||||||
gswe-enumtypes.c.tmp && mv gswe-enumtypes.c.tmp gswe-enumtypes.c
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
`$(GLIB_MKENUMS)` is set in `configure` with
|
`$(GLIB_MKENUMS)` is set in `configure` with
|
||||||
`AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])`.
|
`AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])`.
|
||||||
@ -38,111 +31,6 @@ files, one for the header and one for the code. `$(gswe_enum_headers)`
|
|||||||
contains a list of all the header files that have enum types defined
|
contains a list of all the header files that have enum types defined
|
||||||
throughout the project.
|
throughout the project.
|
||||||
|
|
||||||
{% highlight c %}
|
{% gist gergelypolonkai/1e2fdedb136de3ca67f0 gswe-enumtypes.h %}
|
||||||
/*** BEGIN file-header ***/
|
|
||||||
/* gswe-enumtypes.h - Enumeration types for SWE-GLib
|
|
||||||
*
|
|
||||||
* Copyright © 2013 Gergely Polonkai
|
|
||||||
*
|
|
||||||
* SWE-GLib is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* SWE-GLib is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#ifndef __GSWE_ENUM_TYPES_H__
|
|
||||||
#define __GSWE_ENUM_TYPES_H__
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
/*** END file-header ***/
|
{% gist gergelypolonkai/1e2fdedb136de3ca67f0 gswe-enumtypes.c %}
|
||||||
|
|
||||||
/*** BEGIN file-production ***/
|
|
||||||
/* enumerations from "@filename@" */
|
|
||||||
|
|
||||||
#include "@filename@"
|
|
||||||
/*** END file-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-header ***/
|
|
||||||
GType @enum_name@_get_type(void);
|
|
||||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
|
|
||||||
/*** END value-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN file-tail ***/
|
|
||||||
|
|
||||||
#endif /* __GSWE_ENUM_TYPES_H__ */
|
|
||||||
/*** END file-tail ***/
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
{% highlight c %}
|
|
||||||
/*** BEGIN file-header ***/
|
|
||||||
/* gswe-enumtypes.c - Enumeration types for SWE-GLib
|
|
||||||
*
|
|
||||||
* Copyright © 2013 Gergely Polonkai
|
|
||||||
*
|
|
||||||
* SWE-GLib is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* SWE-GLib is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include "swe-glib.h"
|
|
||||||
#include "gswe-enumtypes.h"
|
|
||||||
#include "@filename@"
|
|
||||||
|
|
||||||
/*** END file-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN file-production ***/
|
|
||||||
/* enumerations from "@filename@" */
|
|
||||||
/*** END file-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-header ***/
|
|
||||||
GType
|
|
||||||
@enum_name@_get_type(void)
|
|
||||||
{
|
|
||||||
static volatile gsize g_define_type_id__volatile = 0;
|
|
||||||
|
|
||||||
gswe_init();
|
|
||||||
|
|
||||||
if (g_once_init_enter(&g;_define_type_id__volatile)) {
|
|
||||||
static const G@Type@Value values[] = {
|
|
||||||
/*** END value-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-production ***/
|
|
||||||
{
|
|
||||||
@VALUENAME@,
|
|
||||||
"@VALUENAME@",
|
|
||||||
"@valuenick@"
|
|
||||||
},
|
|
||||||
/*** END value-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-tail ***/
|
|
||||||
{ 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
GType g_define_type_id = g_@type@_register_static(
|
|
||||||
g_intern_static_string("@EnumName@"),
|
|
||||||
values
|
|
||||||
);
|
|
||||||
|
|
||||||
g_once_init_leave(&g;_define_type_id__volatile, g_define_type_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_define_type_id__volatile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** END value-tail ***/
|
|
||||||
{% endhighlight %}
|
|
@ -16,25 +16,7 @@ displayed in small size, so this amount of precision was irrelevant, and
|
|||||||
these numbers took almost half of my SVG images’ size. So I created an
|
these numbers took almost half of my SVG images’ size. So I created an
|
||||||
Elisp defun to round these numbers to 2 decimals:
|
Elisp defun to round these numbers to 2 decimals:
|
||||||
|
|
||||||
{% highlight common-lisp %}
|
{% gist gergelypolonkai/9c721ceda6d3079b4f05 %}
|
||||||
(defun get-number-at-point ()
|
|
||||||
(interactive)
|
|
||||||
(skip-chars-backward "0123456789.-")
|
|
||||||
(or (looking-at "[0123456789.-]+")
|
|
||||||
(error "No number at point"))
|
|
||||||
(string-to-number (match-string 0)))
|
|
||||||
|
|
||||||
(defun round-number-at-point-to-decimals (decimal-count)
|
|
||||||
(interactive "NDecimal count: ")
|
|
||||||
(let ((mult (expt 10 decimal-count)))
|
|
||||||
(replace-match (number-to-string
|
|
||||||
(/
|
|
||||||
(fround
|
|
||||||
(*
|
|
||||||
mult
|
|
||||||
(get-number-at-point)))
|
|
||||||
mult)))))
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
This finds the first digit of the number under point (the cursor), and
|
This finds the first digit of the number under point (the cursor), and
|
||||||
reduces its digits to the given amount (or the number given with `C-u`). It
|
reduces its digits to the given amount (or the number given with `C-u`). It
|
||||||
|
@ -43,9 +43,4 @@ his local repository with the same technique).
|
|||||||
[This StackOverflow answer](http://stackoverflow.com/a/17153598/1305139)
|
[This StackOverflow answer](http://stackoverflow.com/a/17153598/1305139)
|
||||||
suggests the very same, but with some aliases:
|
suggests the very same, but with some aliases:
|
||||||
|
|
||||||
{% highlight ini %}
|
{% gist gergelypolonkai/a98f4aab84659d60364e %}
|
||||||
|
|
||||||
[alias]
|
|
||||||
bisect-fixed = bisect bad
|
|
||||||
bisect-unfixed = bisect good
|
|
||||||
{% endhighlight %}
|
|
||||||
|
347
css/style.sass
347
css/style.sass
@ -64,6 +64,10 @@ article.post
|
|||||||
margin-top: .8em
|
margin-top: .8em
|
||||||
margin-bottom: .5em
|
margin-bottom: .5em
|
||||||
|
|
||||||
|
.gist-data
|
||||||
|
max-height: 300px
|
||||||
|
overflow: auto
|
||||||
|
|
||||||
body
|
body
|
||||||
background-color: $page-background
|
background-color: $page-background
|
||||||
margin: 50px 0 0 0
|
margin: 50px 0 0 0
|
||||||
@ -82,349 +86,6 @@ body
|
|||||||
img
|
img
|
||||||
padding-right: 1em
|
padding-right: 1em
|
||||||
|
|
||||||
.highlight
|
|
||||||
background-color: #fdf6e3
|
|
||||||
color: #586e75
|
|
||||||
padding: 10px
|
|
||||||
|
|
||||||
/* Line Numbers */
|
|
||||||
/* Make line numbers unselectable: excludes line numbers from */
|
|
||||||
/* copy-paste user ops */
|
|
||||||
.lineno
|
|
||||||
color: #93a1a1
|
|
||||||
-webkit-user-select: none
|
|
||||||
-moz-user-select: none
|
|
||||||
-o-user-select: none
|
|
||||||
|
|
||||||
.lineno::-moz-selection /* Mozilla specific */
|
|
||||||
background-color: transparent
|
|
||||||
|
|
||||||
.lineno::selection /* Other major browsers */
|
|
||||||
background-color: transparent
|
|
||||||
|
|
||||||
.code-title
|
|
||||||
text-indent: 0 !important
|
|
||||||
font-size: 120%
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
.code-description
|
|
||||||
border: 1px solid #333
|
|
||||||
background-color: #d9d9d9
|
|
||||||
padding: 3px
|
|
||||||
text-indent: 0 !important
|
|
||||||
margin: .5em 0 0 0 !important
|
|
||||||
font-size: 75%
|
|
||||||
color: #444
|
|
||||||
|
|
||||||
pre
|
|
||||||
font-family: monospace
|
|
||||||
padding: 5px
|
|
||||||
height: 300px
|
|
||||||
overflow: auto
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
*
|
|
||||||
font-family: monospace
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
code
|
|
||||||
/* Comment */
|
|
||||||
.c
|
|
||||||
color: #93a1a1
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
/* Error */
|
|
||||||
.err
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Generic */
|
|
||||||
.g
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Keyword */
|
|
||||||
.k
|
|
||||||
color: #859900
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Literal */
|
|
||||||
.l
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Name */
|
|
||||||
.n
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Operator */
|
|
||||||
.o
|
|
||||||
color: #859900
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Other */
|
|
||||||
.x
|
|
||||||
color: #cb4b16
|
|
||||||
|
|
||||||
/* Punctuation */
|
|
||||||
.p
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Comment.Multiline */
|
|
||||||
.cm
|
|
||||||
color: #93a1a1
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
/* Comment.Preproc */
|
|
||||||
.cp
|
|
||||||
color: #859900
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Comment.Single */
|
|
||||||
.c1
|
|
||||||
color: #93a1a1
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
/* Comment.Special */
|
|
||||||
.cs
|
|
||||||
color: #859900
|
|
||||||
font-weight: bold
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
/* Generic.Deleted */
|
|
||||||
.gd
|
|
||||||
color: #2aa198
|
|
||||||
background-color: #ffdddd
|
|
||||||
|
|
||||||
/* Generic.Deleted.Specific */
|
|
||||||
.x
|
|
||||||
color: #000000
|
|
||||||
background-color: #ffaaaa
|
|
||||||
|
|
||||||
/* Generic.Emph */
|
|
||||||
.ge
|
|
||||||
color: #586e75
|
|
||||||
font-style: italic
|
|
||||||
|
|
||||||
/* Generic.Error */
|
|
||||||
.gr
|
|
||||||
color: #dc322f
|
|
||||||
|
|
||||||
/* Generic.Heading */
|
|
||||||
.gh
|
|
||||||
color: #cb4b16
|
|
||||||
|
|
||||||
/* Generic.Inserted */
|
|
||||||
.gi
|
|
||||||
color: #859900
|
|
||||||
|
|
||||||
/* Generic.Output */
|
|
||||||
.go
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Generic.Prompt */
|
|
||||||
.gp
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Generic.Strong */
|
|
||||||
.gs
|
|
||||||
color: #586e75
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Generic.Subheading */
|
|
||||||
.gu
|
|
||||||
color: #cb4b16
|
|
||||||
|
|
||||||
/* Generic.Traceback */
|
|
||||||
.gt
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Keyword.Constant */
|
|
||||||
.kc
|
|
||||||
color: #cb4b16
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Keyword.Declaration */
|
|
||||||
.kd
|
|
||||||
color: #268bd2
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Keyword.Namespace */
|
|
||||||
.kn
|
|
||||||
color: #859900
|
|
||||||
|
|
||||||
/* Keyword.Pseudo */
|
|
||||||
.kp
|
|
||||||
color: #859900
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Keyword.Reserved */
|
|
||||||
.kr
|
|
||||||
color: #268bd2
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Keyword.Type */
|
|
||||||
.kt
|
|
||||||
color: #dc322f
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Literal.Date */
|
|
||||||
.ld
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Literal.Number */
|
|
||||||
.m
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String */
|
|
||||||
.s
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Name.Attribute */
|
|
||||||
.na
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Name.Builtin */
|
|
||||||
.nb
|
|
||||||
color: #b58900
|
|
||||||
|
|
||||||
/* Name.Class */
|
|
||||||
.nc
|
|
||||||
color: #268bd2
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Name.Constant */
|
|
||||||
.no
|
|
||||||
color: #cb4b16
|
|
||||||
|
|
||||||
/* Name.Decorator */
|
|
||||||
.nd
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Name.Entity */
|
|
||||||
.ni
|
|
||||||
color: #cb4b16
|
|
||||||
|
|
||||||
/* Name.Exception */
|
|
||||||
.ne
|
|
||||||
color: #cb4b16
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Name.Function */
|
|
||||||
.nf
|
|
||||||
color: #268bd2
|
|
||||||
font-weight: bold
|
|
||||||
|
|
||||||
/* Name.Label */
|
|
||||||
.nl
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Name.Namespace */
|
|
||||||
.nn
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Name.Other */
|
|
||||||
.nx
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Name.Property */
|
|
||||||
.py
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Name.Tag */
|
|
||||||
.nt
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Name.Variable */
|
|
||||||
.nv
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Operator.Word */
|
|
||||||
.ow
|
|
||||||
color: #859900
|
|
||||||
|
|
||||||
/* Text.Whitespace */
|
|
||||||
.w
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Literal.Number.Float */
|
|
||||||
.mf
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.Number.Hex */
|
|
||||||
.mh
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.Number.Integer */
|
|
||||||
.mi
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.Number.Oct */
|
|
||||||
.mo
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String.Backtick */
|
|
||||||
.sb
|
|
||||||
color: #93a1a1
|
|
||||||
|
|
||||||
/* Literal.String.Char */
|
|
||||||
.sc
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String.Doc */
|
|
||||||
.sd
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Literal.String.Double */
|
|
||||||
.s2
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String.Escape */
|
|
||||||
.se
|
|
||||||
color: #cb4b16
|
|
||||||
|
|
||||||
/* Literal.String.Heredoc */
|
|
||||||
.sh
|
|
||||||
color: #586e75
|
|
||||||
|
|
||||||
/* Literal.String.Interpol */
|
|
||||||
.si
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String.Other */
|
|
||||||
.sx
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String.Regex */
|
|
||||||
.sr
|
|
||||||
color: #dc322f
|
|
||||||
|
|
||||||
/* Literal.String.Single */
|
|
||||||
.s1
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Literal.String.Symbol */
|
|
||||||
.ss
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
/* Name.Builtin.Pseudo */
|
|
||||||
.bp
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Name.Variable.Class */
|
|
||||||
.vc
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Name.Variable.Global */
|
|
||||||
.vg
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Name.Variable.Instance */
|
|
||||||
.vi
|
|
||||||
color: #268bd2
|
|
||||||
|
|
||||||
/* Literal.Number.Integer.Long */
|
|
||||||
.il
|
|
||||||
color: #2aa198
|
|
||||||
|
|
||||||
|
|
||||||
#keywords-button
|
#keywords-button
|
||||||
font-size: 50%
|
font-size: 50%
|
||||||
color: #7f7f7f
|
color: #7f7f7f
|
||||||
|
Loading…
Reference in New Issue
Block a user