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
var sum = function () { | |
var memo = []; | |
return function (n, a, r) { | |
if (typeof memo[n] !== "undefined") { | |
return memo[n]; | |
} | |
return memo[n] = (n === 1 ? a : a + r * sum(n - 1, a, r)); | |
}; | |
}(); |
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
set showmatch | |
set tabstop=5 | |
set number | |
set autoindent | |
set nocindent | |
set shiftwidth=5 | |
set backspace=indent,eol,start | |
set fileencoding=utf-8 | |
set encoding=utf-8 |
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
#include <stdio.h> | |
int main (void) { | |
int a, n; | |
scanf("%d", &a); | |
switch(a) { | |
case 2 : | |
n = 28; | |
break; | |
case 4 : |
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/bash | |
file="$HOME/.knct_login" | |
tim=100 | |
url="http://10.10.10.10/cgi-bin/opengate" | |
if [ ! -f $file ]; then | |
:> $file |
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
(function () { | |
var regex = /^(https?:\/\/(?:[0-9a-z\-]\.?)+(?::\d+)?)(?:\/.*)?$/, | |
replace = "$1", | |
baseURL = location.href.replace(regex, replace), | |
links = document.links, | |
i, len, href; | |
for (i = 0, len = links.length; i < len; i ++) { | |
href = links[i].href; | |
if (regex.test(href) && href.replace(regex, replace) !== baseURL) { |
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
Function.prototype.applyNew = function (args) { | |
var that = new Object(), res; | |
if (typeof args !== "object" || args.constructor !== Array) { | |
args = []; | |
} | |
if (typeof this.prototype === "object") { | |
that.__proto__ = this.prototype; | |
} |
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
!function () { | |
if (typeof jQuery === "undefined") { return; } | |
var $ = jQuery; | |
Object.prototype.$ = | |
Object.prototype.jQuery = function () { | |
return $(this.valueOf()); | |
}; | |
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
<?php | |
function get_abs_url($url, $base_url = '') { | |
$reg_url = '@^(https?)://([a-z0-9]+(?:\.[-a-z0-9]+)*)(|:\d+)((?:/[^\?]*)?)(|\?.*)$@'; | |
if (preg_match($reg_url, $url, $m)) { | |
return $url; | |
} | |
if (preg_match($reg_url, $base_url, $m)) { |
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 | |
# coding: utf-8 | |
# scanf.py - written by odiak | |
# | |
# example. | |
# i, f = scanf('%d%d') | |
# s = scanf('%s') | |
import sys |
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 |