This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a string that was serialized with jQuery.param back to the object. | |
* | |
* @param {String} str | |
* | |
* @return {Object} | |
*/ | |
function parseParams(str) { | |
var obj = {}, pair; | |
var pairs = decodeURIComponent(str).split( "&" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# ------------------------------------------------------------------------------ | |
# SOME INFOS : fairly standard (debian) init script. | |
# Note that node doesn't create a PID file (hence --make-pidfile) | |
# has to be run in the background (hence --background) | |
# and NOT as root (hence --chuid) | |
# | |
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
# INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* Прототип прототипа, точно работать должен только на тестовом примере | |
* из поста. Для дальнейшей доработки нужно будет ближе ознакомиться со | |
* спецификацией haml и формализовать правила по трансляции имен классов =) | |
* | |
* .b-bl1 | |
* .b-bl2_foo | |
* .__el |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parseUrl = ( url = location.href ) -> | |
params = {} | |
( ( parts = part.split( "=" ) ) && params[ parts[0] ] = parts[1] for part in ( url.split "?" ).pop().split "&" if url.indexOf( "?" ) != -1 ) && params || {} | |
$ -> | |
console.log parseUrl( "http://test.com/?a=b" ) | |
console.log parseUrl( "http://test.com" ) | |
console.log parseUrl() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="tpl" type="text/x-query-tmpl"> | |
<ul> | |
{{tmpl ({ checkboxes: true, items: someitems }) "#genlist" }} | |
{{tmpl ({ checkboxes: false, items: otheritems }) "#genlist" }} | |
</ul> | |
</script> | |
<script id="genlist" type="text/x-query-tmpl"> | |
{{each (idx, item) items}} | |
<li>{{if selectable }}<input type="checkbox" />{{/if}}${item.title}</li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, os, math | |
from PIL import Image | |
def usage(): | |
print ("Usage:") | |
print ("\tcompress input_file out_image") | |
print ("\tcompress -d image out_file") |
NewerOlder