Skip to content

Instantly share code, notes, and snippets.

View siygle's full-sized avatar

S.Y. Lee siygle

View GitHub Profile
@siygle
siygle / grunt config
Created November 30, 2012 18:58
deploy to s3
grunt.registerMultiTask('deploy', 'deploy program to cloud', function() {
var pkgcloud = require('pkgcloud')
, walk = require('walk')
, fs = require('fs')
, done = this.async()
, self = this;
grunt.log.w
@siygle
siygle / convert.js
Created October 4, 2012 06:36
Convert Big5 to UTF8 using node-iconv
var http = require('http')
, Buffer = require('buffer').Buffer
, Iconv = require('iconv').Iconv;
var options = {
host: 'mis.tse.com.tw',
path: '/data/4930.csv?r=' + new Date().getTime(),
method: 'GET',
};
var iconv = new Iconv('Big5', 'UTF8');
@siygle
siygle / index.html
Created October 1, 2012 10:19
nodejs sample using Persona
<!doctype html>
<html>
<head>
<style>
.persona {
border: 1px solid #666;
width: 100px;
text-align: center;
margin: 5px;
}
@siygle
siygle / gist:3533209
Created August 30, 2012 16:57
casperjs official example
var links = [];
var casper = require('casper').create();
function getLinks() {
var links = document.querySelectorAll('h3.r a');
return Array.prototype.map.call(links, function(e) {
return e.getAttribute('href')
});
}
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.css" media="screen" type="text/css">
</head>
<body>
<div class="box sunrise"><a href="#box2"></a></div>
<div class="slider">
<div class="box sunset"><a href="#box1"></a></div>
</div>
@siygle
siygle / gist:3070299
Created July 8, 2012 10:00
grunt example
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// use test module for testing, QUnit default but support different testing framework using different plugin
test: {
all: ['test/**/*.js']
},
// run jsLint to check your program
lint: {
.box {
width: 880px;
height: 330px;
border-radius: .5em;
}
.sunrise {
position: absolute;
background: #eee;
box-shadow: 0 0 10px rgba(0, 0, 0, .7);
}
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<a href=http://github.co
@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
@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>