Skip to content

Instantly share code, notes, and snippets.

View odiak's full-sized avatar

Kaido Iwamoto odiak

View GitHub Profile
@odiak
odiak / test.c
Created March 1, 2011 00:07
test
#include <stdio.h>
int main ( int argc, char *argv[] ) {
return 0;
}
@odiak
odiak / NumberCount.example.js
Created March 1, 2011 00:08
using closure.
var c = new Counter();
c.add(); // 1
c.get(); // 1
c.add(); // 2
var n;
n = c + 1; // n == 3
response.write("hello, world");
exist_pid(){
res=`ps ax | sed "s/^\s\+\?\([0-9]\+\).\+$/\1/g" | grep "^${1}$" | wc -l`
if test $res -ge 1
then
return true
else
return false
fi
}
Object.prototype._new_ = function () {
var args = Array.apply([], arguments);
return eval("new this(" + args.join(",") + ")");
};
// sample
Array._new_(1,2,3); // [1,2,3]
Object._new_(); // {}
Number._new_(33); // 33
(function () {
var re = {};
// define board
re.board = [];
jQuery.create = function (tagName, innerText, attributes) {
var res;
if (typeof innerText === "undefined" || !innerText) {
innerText = "";
}
if (typeof attributes === "undefined" || !attributes) {
attributes = {};
}
@odiak
odiak / jQuery.encodeJSON.js
Created April 6, 2011 08:31
jquery extension.
jQuery.encodeJSON = function ($) {
var enc = function (data) {
var res = "", a, b;
switch (typeof data) {
case "number" :
return data + "";
case "string" :
res = escape(data);
@odiak
odiak / fuck.js
Created April 14, 2011 09:11
alert(1);
(+[])[([][(![]+[])[+[]]+([]+![]+[][+[]])[(+!+[]+[]+[])+(+[])]+([]+![])[!+[]+!+[]]+([]+!![])[+[]]+([]+!![])[!+[]+!+[]+!+[]]+([]+!![])[+!+[]]]+[])[!+[]+!+[]+!+[]]+([]+!![]+[][(![]+[])[+[]]+([]+![]+[][+[]])[(+!+[]+[]+[])+(+[])]+([]+![])[!+[]+!+[]]+([]+!![])[+[]]+([]+!![])[!+[]+!+[]+!+[]]+([]+!![])[+!+[]]])[(+!+[]+[]+[])+(+[])]+([][+[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][+[]]+[])[+[]]+([][(![]+[])[+[]]+([]+![]+[][+[]])[(+!+[]+[]+[])+(+[])]+([]+![])[!+[]+!+[]]+([]+!![])[+[]]+([]+!![])[!+[]+!+[]+!+[]]+([]+!![])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([]+!![]+[][(![]+[])[+[]]+([]+![]+[][+[]])[(+!+[]+[]+[])+(+[])]+([]+![])[!+[]+!+[]]+([]+!![])[+[]]+([]+!![])[!+[]+!+[]+!+[]]+([]+!![])[+!+[]]])[(+!+[]+[]+[])+(+[])]+(!![]+[])[+!![]]][([][(![]+[])[+[]]+([]+![]+[][+[]])[(+!+[]+[]+[])+(+[])]+([]+![])[!+[]+!+[]]+([]+!![])[+[]]+([]+!![])[!+[]+!+[]+!+[]]+([]+!![])[+!+[]]]+[])[!+[]+!+[]+!+[]]+([]+!![]+[][(![]+[])[+[]]+([]+![]+[][+[]])[(+!+[]+[]+[])+(+[])]+([]+![])[!+[]+!+[]]+([]+!![])[+
#include <stdio.h>
int sum (int n, int a, int r) {
if (n == 1) {
return a;
}
return a + r * sum(n - 1, a, r);
}
int main (int argc, char *argv[]) {