Skip to content

Instantly share code, notes, and snippets.

@siygle
siygle / category_cloud.rb
Created September 2, 2011 19:45
jekyll plugin sample: category_cloud
module Jekyll
class CategoryCloud < Liquid::Tag
def render(context)
html = ""
categories = context.registers[:site].categories.map{|key, value|
{
"title" => key,
"posts" => value
}
}
@siygle
siygle / gist:1408646
Created November 30, 2011 10:51
dnode pass function call
// server side
var dnode = require('dnode');
var server = dnode({
zing: function (n, cb) { cb(n*100) }
});
server.listen(5050);
@siygle
siygle / gist:1441262
Created December 7, 2011 03:07
CSS Transform
$(document).ready(function(){
$(".click").toggle(function(){
$("#box").css("-webkit-transform","scale(2.1) rotate(-90deg)");
},
function () {
$("#box").css("-webkit-transform","scale(1) rotate(0)");
})
})
@siygle
siygle / gist:1575777
Created January 7, 2012 19:44
hashish sample
//Example 1: basic method
var Hash = require('hashish');
Hash({ a : 1, b : 2, c : 3, d : 4 })
.map(function (x) { return x * 10 })
.filter(function (x) { return x < 30 })
.forEach(function (x, key) {
console.log(key + ' => ' + x);
})
;
@siygle
siygle / gist:1575828
Created January 7, 2012 20:01
optimist sample
#!/usr/bin/env node
var argv = require('optimist')
.usage('Usage: $0 --snsd [member] --tara [song]')
.demand(['snsd'])
//.default({ 'snsd': 'Yuri', 'tara': 'Roly Poly'})
.alias('snsd', 'gg')
.describe({'snsd': 'Girls\'s Generation', 'tara': 'T-ARA'})
.argv;
console.log(argv.snsd + ":" + argv.tara);
@siygle
siygle / gist:2292713
Created April 3, 2012 15:00
browserid example
<!-- Please remember include 'include.js' -->
<script src="https://browserid.org/include.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('#browserid').click(function(){
navigator.id.get(gotAssertion);
return false;
});
});
@siygle
siygle / gist:2292766
Created April 3, 2012 15:06
browserid server example
#!/usr/bin/env node
const
express = require('express'),
sessions = require('client-sessions'),
path = require('path'),
postprocess = require('postprocess'),
https = require('https'),
url = require('url');
@siygle
siygle / index.html
Created May 31, 2012 18:32
Absolute Center
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<div id="logo">LOGO</div>
</div>
</body>
@siygle
siygle / onx
Created June 6, 2012 16:17
on{x} sample: notify to bring umbrella when it's rainy day
// Initializing variables
var reminder = "take an umbrella";
var weatherCondition = "rainy";
// End of variables initializing
console.log('Started script: Remind me to ' + reminder + ' every day the first time I unlock my phone, if it is going to be ' + weatherCondition);
// register callback to device unlocked event
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<a href=http://github.co