Skip to content

Instantly share code, notes, and snippets.

@tricknotes
tricknotes / compile-coffeescript.watchr.rb
Created Oct 16, 2011
CoffeeScriptをコンパイルするwatchr
View compile-coffeescript.watchr.rb
require "open3"
watch('(.*)\.coffee') do |md|
stdin, stdout, stderr = Open3.popen3("coffee -o dist/js/ -c #{md[0]}")
error_message = ''
unless stderr.eof?
error_message << stderr.to_a.join
end
@tricknotes
tricknotes / config.ru
Created Nov 12, 2011
config.ru for gollum
View config.ru
require 'rubygems'
require 'bundler/setup'
require 'gollum/frontend/app'
Precious::App.set(:gollum_path, File.dirname(__FILE__))
Precious::App.set(:wiki_options, {})
run Precious::App
@tricknotes
tricknotes / index.html
Created Nov 29, 2011
refactoring-demo for SaCSS vol.29
View index.html
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
width: 100%;
height: 100%;
background-color: #666;
}
canvas {
@tricknotes
tricknotes / mongolab.error.json
Created Nov 30, 2011
error log for mongolab
View mongolab.error.json
{
"message": "can't call something : /10.44.119.163:29117/xx_watcher",
"class": "com.mongodb.MongoException$Network",
"stackTrace": [
"com.mongodb.DBPort._open(DBPort.java:206)",
"com.mongodb.DBPort.go(DBPort.java:94)",
"com.mongodb.DBPort.go(DBPort.java:75)",
"com.mongodb.DBPort.findOne(DBPort.java:129)",
"com.mongodb.DBPort.runCommand(DBPort.java:138)",
"com.mongodb.DBPort.checkAuth(DBPort.java:283)",
View quota_exceeded_error.json
{ [MongoError: quota exceeded]
name: 'MongoError',
err: 'quota exceeded',
code: 12501,
n: 0,
lastOp: { low_: 2, high_: 1324977215 },
connectionId: 64862,
ok: 1 }
View gist:2793995
PROMPT="function %n() { "
RPROMPT="};"
@tricknotes
tricknotes / zenkaku_hankaku.js
Created Oct 14, 2012
JavaScript での全角・半角の正規表現
View zenkaku_hankaku.js
// see: http://gimite.net/gimite/rubymess/moji.html
var zenkaku = /(?:[ !”#$%&’()*+,-./:;<=>?@[¥]^_‘{|} ̄])|(?:[、。・゛゜´`¨ヽヾゝゞ〃仝々〆〇ー―‐\~〜∥…‥“〔〕〈〉《》「」『』【】±×÷≠≦≧∞∴♂♀°′″℃¢£§☆★○●◎◇◇◆□■△▲▽▼※〒→←↑↓〓])|(?:[0-9])|(?:[A-Z])|(?:[a-z])|(?:[ぁ-ん])|(?:[ァ-ヶ])|(?:[Α-Ωα-ω])|(?:[А-Яа-я])|(?:[\u2570-\u25ff])|(?:[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff])/;
var hankaku = /(?:[\x00-\x1f\x7f])|(?:[ !"#$%&'()*+,\-.\/:;<=>?@\[\\\]\^_`{|}~])|(?:[\uFF61\uFF62\uFF63\uFF64\uFF70\uFF9E\uFF9F\uFF65])|(?:[0-9])|(?:[A-Z])|(?:[a-z])|(?:[\uFF66-\uFF6F\uFF71-\uFF9D])/;
@tricknotes
tricknotes / printout.js
Created Oct 31, 2012
Gist を印刷する時に良い感じのレイアウトにする
View printout.js
// For printout https://gist.github.com
// DOM
$('#header').remove();
$('#repos').remove();
$('.secondary').remove();
$('.meta').remove();
$('#footer').remove();
$('.push').remove();
$('#comments').remove();