Skip to content

Instantly share code, notes, and snippets.

View torounit's full-sized avatar

Hiroshi Urabe torounit

View GitHub Profile
@torounit
torounit / Gruntfille.coffee
Created April 14, 2014 14:25
bower_concatを使う。bowerでインストールしたjsをassets/js/lib.jsにまとめる。
module.exports = (grunt) ->
pkg = grunt.file.readJSON("package.json")
#
# taskをロード
#
for taskName of pkg.devDependencies
grunt.loadNpmTasks taskName if taskName.substring(0, 6) is "grunt-"
@torounit
torounit / gridMixin.scss
Last active August 29, 2015 14:00
おれおれ Grid System Mixin.
//
// =================================
//
// #Layout Grid Mix-in.
//
// ##Params
// * $unitClassName グリッドのclass名
// * $maxCols カラムの分割数
// * $width 横幅
@torounit
torounit / Gruntfile.coffee
Last active August 29, 2015 14:00
最近のGruntfile
module.exports = (grunt) ->
# ==================================
#
# Load Tasks.
#
# ==================================
pkg = grunt.file.readJSON('package.json')
for taskName of pkg.devDependencies
@torounit
torounit / Tweets.php
Last active August 29, 2015 14:01
Twitter APIで取得したTweets Objectをちょっと便利にするクラス。 Tweets (https://dev.twitter.com/docs/platform-objects/tweets)
<?php
Class Tweets extends ArrayObject {
public function __construct( Array $tweets ) {
foreach($tweets as $key => $tweet) {
$this->offsetSet($key, $this->createTweet($tweet));
}
}
@torounit
torounit / helper.rb
Last active August 29, 2015 14:01
Middlemanのimage_tagの拡張。srcsetでRetina用の画像を追加。
helpers do
def image_tag(path,params = {})
if !params.key?(:srcset)
basename = File.basename(path, '.*')
ext = File.extname(path)
real_path = path.sub(basename + ext,basename + "@2x" + ext )
real_path = File.join(images_dir, real_path) unless real_path.start_with?('/')
@torounit
torounit / mixin.scss
Created May 19, 2014 05:46
rem Helper
@function rem($size) {
@return #{$size / $base-fontSize}rem;
}
@mixin font-size($size) {
font-size: $size;
font-size: rem($size);
}
@mixin line-height($size) {
@torounit
torounit / 0_reuse_code.js
Created May 22, 2014 04:57
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@torounit
torounit / parse.coffee
Last active August 29, 2015 14:01
URLをParseして、適当にクラスをつける。適当実装。
do($=jQuery) =>
$(".l-navigation__item").find("a").each ->
origin = location.origin
href = @.href.replace origin, ""
dir = href.replace "index.html", ""
if dir == "/" or dir == ""
#TOPの場合。
pathname = location.pathname.replace "index.html", ""
if pathname == "/" or pathname == ""
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="eastwood"
# Example aliases
@torounit
torounit / pageLink.coffee
Created May 27, 2014 11:07
ページ内リンクをスムーススクロールにするScript