Skip to content

Instantly share code, notes, and snippets.

@taiansu
taiansu / JsAssert.html
Created August 3, 2011 18:47
Javascript assert
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>JavaScript Testing Lab</title>
<style>
.pass:before {
content: 'PASS: ';
color: blue;
font-weight: bold;
@taiansu
taiansu / .bash_profile
Created August 8, 2011 07:01 — forked from ihower/gist:897951
bash_profile setting
export CLICOLOR=1;
export LSCOLORS=ExFxCxDxBxegedabagacad;
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
function git_since_last_commit {
now=`date +%s`;
@taiansu
taiansu / memusage.rb
Created October 7, 2011 14:05 — forked from sxalexander/memusage.rb
WebFaction Memory Usage Script
#!/usr/bin/env ruby
# Memory usage script for WebFaction customers adapted to attempt to
# draw username from the pwd
# Nick Trew <vxnick@gmail.com>
# 2009-05-25
# START CONFIG #
require 'pathname'
@taiansu
taiansu / detect_cleartype.js
Created December 27, 2011 17:15 — forked from cbeier/detect_cleartype.js
detect ClearType using javascript
/*
* TypeHelpers version 1.0
* Zoltan Hawryluk, Nov 24 2009.
* @see http://www.useragentman.com/blog/2009/11/29/how-to-detect-font-smoothing-using-javascript/
*
* Released under the MIT License. http://www.opensource.org/licenses/mit-license.php
*
* Works for
* - IE6+ (Windows),
* - Firefox 3.5+ (Windows, Mac, Linux),
@taiansu
taiansu / mapreduce.js
Created December 28, 2011 11:45 — forked from adomado/mapreduce.js
Simple MapReduce with Javascript
var Job = {
data : [
"We are glad to see you here. This site is dedicated to",
"poetry and to the people who make poetry possible",
"poets and their readers. FamousPoetsAndPoems.com is",
"a free poetry site. On our site you can find a large",
"collection of poems and quotes from over 631 poets",
"Read and Enjoy Poetry",
"I, too, sing America",
@taiansu
taiansu / GitRepos.rb
Created January 31, 2012 04:53
GetUserCollabraotrsRedesign
require "httparty"
class GitRepos
include HTTParty
base_uri "https://api.github.com"
headers 'Accept' => 'application/json'
format :json
def get_repos_by_user(user)
repos = self.class.get("/users/#{user}/repos")
@taiansu
taiansu / kid.rb
Last active October 2, 2015 08:58
The Kid back in town.
def char_to_block(sentence_ary, &block)
if block_given? then
sentence_ary.each do |sentence|
sentence.split(//).each do |char|
block.call(char)
end
puts
end
else
puts sentence_ary.join("\n");
@taiansu
taiansu / .gitignore_global
Created March 30, 2012 13:01
Global GIT ignore file
# Global GIT ignore file list.
# These files will be ignored from all GIT repositories on the system.
# Mac files.
*.DS_Store
# Swap files.
*.swp
*.swn
*.swo
@taiansu
taiansu / err.log
Created April 19, 2012 19:07
Error log of installing v8 via homebrew
Error: SHA1 mismatch
Expected: 634c5eed18599c57c695cf58acdda59d
Got: 111bf871bda84e72fdf93f2877d97591b918db2a
Archive: /Library/Caches/Homebrew/v8-3.9.24.tgz
(To retry an incomplete download, remove the file above.)
@taiansu
taiansu / args.coffee
Created May 26, 2012 10:11
Manipulate the arguments
f = (a, b, c...) ->
console.log "arguments: #{a}, #{b}, #{c}".replace(/, $/,"")
for arg, i in arguments
console.log "#{i}: #{arg}"
f "ruby"
#"ruby"
#"0: ruby"
f "ruby", "coffeescript"
###