Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Takazudo / fiddle.css
Created September 13, 2011 17:58
shorten URL using bit.ly API (dirty)
We couldn’t find that file to show.
@Takazudo
Takazudo / randomPick.js
Created October 29, 2011 10:27
randomPick/randomNum
/* need underscore.js */
/**
* randomNum
* randomNum(3,6); => 4
*/
var randomNum = function(from, to) {
return from + Math.floor( Math.random() * (to - from + 1) );
};
<div class="mod-oremodule">
<div class="mod-oremodule-hd">
<h1>ore module</h1>
</div>
<div class="mod-oremodule-bd">
<p class="mod-oremodule-bd-p">hogehoge</p>
<p class="mod-oremodule-bd-footnote">hogepuyo</p>
</div>
</div>
$.widget('mod.hoge', {
_create: function(){
alert('this method will be called first');
this.method1();
this.method2();
this.method3();
},
method1: function(){
...
},
(function() {
var SomeUI;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
SomeUI = (function() {
function SomeUI($el) {
this.$el = $el;
this.$content = $el.find('.content');
this.$button1 = $el.find('.button1');
this.$button2 = $el.find('.button2');
this._eventify();
@Takazudo
Takazudo / Cakefile
Created February 17, 2012 17:03
coffee cakefile
{print} = require 'util'
{spawn} = require 'child_process'
task 'build', 'Build lib/ from src/', ->
coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src']
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
print data.toString()
coffee.on 'exit', (code) ->
@Takazudo
Takazudo / Cakefile
Created February 17, 2012 18:14
Cakefile to concatenate, minify coffee
# ==================================================================
# Cakefile - compile, concatenate, minify coffee
# ==================================================================
# ├─ Cakefile
# ├─ lib
# │   ├─ all.js
# │   └─ all.min.js
# └─ src
# ├─ fuga.coffee
# └─ hoge.coffee
@Takazudo
Takazudo / Cakefile
Created February 22, 2012 16:49
growlnotify sample
# ==================================================================
# Cakefile - compile, concatenate, minify coffee
# ==================================================================
# ├─ Cakefile
# ├─ lib
# │   ├─ all.js
# │   └─ all.min.js
# └─ src
# ├─ fuga.coffee
# └─ hoge.coffee
@Takazudo
Takazudo / grunt.js
Created February 22, 2012 21:43
grunt.js example
var proc = require('child_process');
config.init({
lint: {
files : [ 'hoge.js', 'fuga.js' ]
},
concat: {
'all.js' : [ 'hoge.js', 'fuga.js', 'cofall.js', '_coftemp.js' ]
},
@Takazudo
Takazudo / indenttoggle.vim
Created February 23, 2012 18:33
toggle indent
"---------------------------------------------------------------------------
" tab setting toggle macro
fun! g:Ind2sp()
setlocal softtabstop=2
setlocal shiftwidth=2
setlocal expandtab
endfun
fun! g:Ind4sp()
setlocal softtabstop=4