View calc.lisp
1 2 3 4 5 6 7 8 9 10
(defun calc (expression)
(eval (convert-sexp (calc-paren expression))))
 
(defun split (separator sequence)
"`separator'で分割する"
(labels ((rec (sequence)
(let ((pos (position separator sequence)))
(if (not pos) (list sequence)
(cons (subseq sequence 0 pos)
(rec (subseq sequence (1+ pos))))))))
View fuzzy.py
1 2 3 4 5 6 7 8 9 10
from time import localtime
 
hours = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve"]
minutes = ["five", "ten", "quarter", "twenty", "twenty-five", "half"]
relatives = ["past", "to"]
 
def fuzzy():
timern = localtime()
hourrn = timern[3]%12-1
minutern = int(timern[4]/5)
View javascript_resources.md

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
View 0_reuse_code.js
1 2
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View network_down.sh
1 2 3
#!/bin/bash
cd "$(dirname "$0")"
exec ./"$1"/down.sh "$1"
View git-checklist.md

Here's a checklist of some generic steps and git commands that I use:

  • Fork the project
  • Clone it to your local development system git clone
  • Set up your git remotes (origin and upstream) git remote -v git remote add <remote name> <url of remote repo> Note: you will only need to do this step once.
  • Create a local branch for any new development git branch <feature branch name> and checkout the branch git checkout <feature branch name>
  • Develop and commit changes to the local branch git add, git commit, git log, git status
  • Get the most up to date version of the upstream code git fetch upstream
  • Rebase your changes onto upstream git rebase upstream/master Use git log to check that your commit is the most recent.
  • Push the changes to your GitHub repo git push origin <feature branch name>
View gist:9c29bd4b04da17bb8a8d
1 2 3 4 5
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
</IfModule>
View IOS screenShot Detection
1 2 3 4 5 6
let mainQueue = NSOperationQueue.mainQueue()
NSNotificationCenter.defaultCenter().addObserverForName(UIApplicationUserDidTakeScreenshotNotification,
object: nil,
queue: mainQueue) { notification in
// executes after screenshot
}
View gist:a3b71077f95e643069c7
1 2 3 4 5
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
</IfModule>
View gist:9c903bc25b04fdc16a7d
1 2 3 4 5 6 7 8 9
body {
background-image: url("../img/14781951071_171cbcfbed_k.jpg");
color: #fff;
}
 
.container {
width: 50%;
margin: 0 auto;
}
Something went wrong with that request. Please try again.