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 MyModel = Backbone.Model.extend({ | |
| initialize: (attrs){ | |
| var self = this; | |
| self.updateDate(); | |
| self.bind('change:date', function(){ | |
| self.updateDate(); | |
| }); | |
| }, | |
| updateDate: function(){ | |
| var date = this.get('date'); |
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 gplusoneLoaded = false; | |
| // gplus | |
| var $gplus = $('#somewhere'); // the src is like <div id="somewhere"><!-- put plus button here! --></div> | |
| if($gplus.size()){ | |
| window.___gcfg = {lang: 'ja'}; | |
| $gplus.html('<div class="g-plusone" data-size="medium" data-href="' + window.location.href + '"></div>'); | |
| if(!gplusoneLoaded){ | |
| gplusoneLoaded = true; | |
| $.getScript("https://apis.google.com/js/plusone.js"); |
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! CSS3PropertyDuplicate() | |
| let reg_save = @@ | |
| silent normal Y | |
| let css3 = @@ | |
| let ind = matchlist(css3, '\v(\s*)(.*)') | |
| let webkit = ind[1] . "-webkit-" . ind[2] | |
| let moz = ind[1] . "-moz-" . ind[2] | |
| let ms = ind[1] . "-ms-" . ind[2] | |
| let o = ind[1] . "-o-" . ind[2] |
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
| "--------------------------------------------------------------------------- | |
| " tab setting toggle macro | |
| fun! g:Ind2sp() | |
| setlocal softtabstop=2 | |
| setlocal shiftwidth=2 | |
| setlocal expandtab | |
| endfun | |
| fun! g:Ind4sp() | |
| setlocal softtabstop=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
| var proc = require('child_process'); | |
| config.init({ | |
| lint: { | |
| files : [ 'hoge.js', 'fuga.js' ] | |
| }, | |
| concat: { | |
| 'all.js' : [ 'hoge.js', 'fuga.js', 'cofall.js', '_coftemp.js' ] | |
| }, |
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
| # ================================================================== | |
| # Cakefile - compile, concatenate, minify coffee | |
| # ================================================================== | |
| # ├─ Cakefile | |
| # ├─ lib | |
| # │ ├─ all.js | |
| # │ └─ all.min.js | |
| # └─ src | |
| # ├─ fuga.coffee | |
| # └─ hoge.coffee |
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
| # ================================================================== | |
| # Cakefile - compile, concatenate, minify coffee | |
| # ================================================================== | |
| # ├─ Cakefile | |
| # ├─ lib | |
| # │ ├─ all.js | |
| # │ └─ all.min.js | |
| # └─ src | |
| # ├─ fuga.coffee | |
| # └─ hoge.coffee |
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
| {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) -> |
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 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(); |
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
| $.widget('mod.hoge', { | |
| _create: function(){ | |
| alert('this method will be called first'); | |
| this.method1(); | |
| this.method2(); | |
| this.method3(); | |
| }, | |
| method1: function(){ | |
| ... | |
| }, |