Skip to content

Instantly share code, notes, and snippets.

@gaspanik
gaspanik / gulpfile.js
Last active July 10, 2021 13:37
sample gulpfile.js
// Original: https://github.com/gaspanik/gulpbase/
// Update 0.2.0
var gulp = require('gulp'),
// 列挙するのが面倒なので、load-pluginsでプラグインをロード。何使ってるかは「package.json」で
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*'],
replaceString: /\bgulp[\-.]/
@maepon
maepon / gist:6434811
Last active December 22, 2015 06:59
Trust Formでフォームが長くなった時にフィールドの追加がめんどくさくなるのでフィールドのボックスが追従するようにしたJavaScript。検証は適当。
// admin/make-form.phpの最後にscriptタグで追加
(function($){
var $box = $('#standard-form'),
boxBaseOffsetY = $box.offset().top;
$box.css({
position: 'absolute',
left:0,
@hail2u
hail2u / Gruntfile.js
Last active December 21, 2015 13:09
This Grunt task renders `foo.hbs` using data based on `metadata.json` (Base) and `foo.json` (Extend) with Handlebars.js. `foo.hbs` can include other Handlebars.js template (e.g. `styles.inc.hbs`).
module.exports = function (grunt) {
grunt.initConfig({
generate: {
all: {
expand: true,
cwd: '.grunt/html/',
src: ['**/*.hbs', '!**/*.inc.hbs'],
filter: 'isFile',
dest: './',
ext: '.html'
@hail2u
hail2u / file3.txt
Created August 4, 2013 11:56
Handlebars.jsでSSIライクなインクルードを行うヘルパー関数 ref: http://qiita.com/hail2u/items/ea68e89355d25d357ee3
$ node include-helper.js test,tmpl
<p>apple is sweet and red.</p>
<p>orange is sweet and orange.</p>
<p>grape is sweet and purple.</p>
@masamunet
masamunet / Gruntfile.coffee
Last active December 20, 2015 13:29
ぼくがかんがえたさいきょうのGruntfileを晒してみる ref: http://qiita.com/masamunet/items/34022da57e2143d9084a
#除外ファイル
exclude = [
'!**/.DS_Store'
'!**/Thumbs.db'
'!**/*.coffee'
'!**/*.map'
'!**/*.scss'
'!**/*.less'
'!**/*.s.css'
'!**/*.l.css'
@gaspanik
gaspanik / main.js
Created May 25, 2013 08:47
jQuery(CDN/Fallback) & Bootstrap load by Requirejs
requirejs.config({
baseUrl: '/js',
paths: {
jquery: ['//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min','jquery.min'],
bootstrap: 'bootstrap.min'
},
shim: {
'bootstrap':{deps: ['jquery']}
}
});
@gaspanik
gaspanik / screenshots.js
Last active December 17, 2015 12:19 — forked from nhoizey/screenshots.js
Take screenshots at different viewport sizes using CasperJS
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Original:
* nhoizey / screenshots.js https://gist.github.com/nhoizey/4060568
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
@gaspanik
gaspanik / TXT: kkmsz-ibdsgn-vol1.markdown
Created April 18, 2013 07:33
how to install node.js

Designing in the browser Vol. 1

こけむさずで開催した「インブラウザ勉強会」の補足。

Installing Node.js

Node.jsのインストールは自分の好きな方法でどうぞ。簡単なのはもちろん1です。

  1. Node.jsのインストールは公式サイトの「Download」からバイナリをインストールする
  2. Homebrewで「brew install node」を実行する
@hideki-a
hideki-a / Gruntfile.coffee
Last active December 14, 2015 15:09
Original gruntfile for generator-website.
'use strict'
PROJECT_DIR = ''
LIVERELOAD_PORT = 35729
lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT })
proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest
mountFolder = (connect, dir) ->
return connect.static(require('path').resolve(dir))
module.exports = (grunt) ->
grunt.initConfig