Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Takazudo / dynamic_gplus.js
Created March 1, 2012 11:54
put google plus button dynamically
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");
@Takazudo
Takazudo / css3-property-duplicate
Created February 24, 2012 12:10 — forked from edom18/css3-property-duplicate
CSSのプロパティを、ベンダープレフィクス付きで複製するスクリプト。(インデントも引き継ぐよう修正)
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]
@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
@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 / 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 / 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 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) ->
(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();
$.widget('mod.hoge', {
_create: function(){
alert('this method will be called first');
this.method1();
this.method2();
this.method3();
},
method1: function(){
...
},
<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>