Skip to content

Instantly share code, notes, and snippets.

View siygle's full-sized avatar

S.Y. Lee siygle

View GitHub Profile
@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 / 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: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: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: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: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 / 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 / test.php
Created July 15, 2011 18:45
Monolog example
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
//create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('/path/to/log', Logger::WARNING));
// add records to the log
@siygle
siygle / gist:1062418
Created July 3, 2011 17:52
WordPress XMLRPC sample
<?php
$username = '';
$password = '';
$blogid = ''; // Can get using wp.getUsersBlogs
$target_host = '';
$xmlrpc_method = '';
function get_response($url, $context){
if(!function_exists('curl_init')){
<!-- layout.html.twig -->
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<title>Welcome to Twig</title>
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
</body>