Skip to content

Instantly share code, notes, and snippets.

View geckotang's full-sized avatar
:octocat:

Shotaro Sakamaki geckotang

:octocat:
View GitHub Profile
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",
@xl1
xl1 / gist:3111497
Created July 14, 2012 14:04
SCSS で単位を落とす
/*
@function int($x) {
$list: ();
@for $i from floor($x - $x) to floor($x) {
$list: append($list, 0);
}
@return length($list);
}
*/
// もっとよいやり方がある
@hokaccha
hokaccha / git-export-diff
Created September 22, 2012 02:14
gitの差分のファイルをつくる
#!/bin/sh
set -e
if [ $# -ne 2 -a $# -ne 3 ]; then
echo 'Usage:'
echo ' $ git export-diff <commit> <output_dir>'
echo ' $ git export-diff <commit> <commit> <output_dir>'
exit 1
fi
@xl1
xl1 / gist:4353507
Last active September 6, 2016 09:25
CSS でフォームの値を読む

CSS でフォームの値を読む

これは CSS Programming Advent Calendar 2012 の 21 日目の記事です。がすでに 22 日になってしまいました。ごめんなさい。

7 日目の記事(ドラッグをキメる) で、input 要素の value の値は「CSS で検知できない」と書きましたが、嘘です。ごめんなさい。

それ実は CSS でできるよ!

Client-Side Form Validation の仕組みを無理やり使います。 inputpattern 属性と :valid, :invalid 疑似クラスで、特定の文字列のみに反応してスタイルを適用できます。

@terkel
terkel / _easing.scss
Last active April 8, 2024 13:40
Timing functions for CSS animations and transitions
// _easing.scss, CSS easing functions - gist.github.com/terkel/4377409
// Based on Caesar - matthewlein.com/ceaser
$linear: cubic-bezier( 0.250, 0.250, 0.750, 0.750 );
$ease: cubic-bezier( 0.250, 0.100, 0.250, 1.000 );
$ease-in: cubic-bezier( 0.420, 0.000, 1.000, 1.000 );
$ease-out: cubic-bezier( 0.000, 0.000, 0.580, 1.000 );
$ease-in-out: cubic-bezier( 0.420, 0.000, 0.580, 1.000 );
$ease-in-quad: cubic-bezier( 0.550, 0.085, 0.680, 0.530 );
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@dsuket
dsuket / Gruntfile.js
Last active December 17, 2015 20:28
更新されたファイルだけ対象にするフィルタの定義
module.exports = function(grunt) {
var fs = require('fs');
// ファイルのmtimeを比較
var compareMtime = function(src, target) {
var isNewer = true;
if (fs.existsSync(target)) {
isNewer = fs.statSync(src).mtime > fs.statSync(target).mtime;
}
@watilde
watilde / gruntfile.js
Last active December 17, 2015 21:39
Easy to write to load grunt plugin.
/**
* @fileOverview Easy to write to load grunt plugin.
* @author Daijiro Wachi
*/
module.exports = function(grunt) {
"use strict";
/** @type {object} pkg */
var pkg = grunt.file.readJSON("package.json");
//-----------------------------------------------
//CSS Flexible Box Layout Module Mixin
//W3C Candidate Recommendation, 18 September 2012
//http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/
//-----------------------------------------------
//Flex Containers: the ‘flex’ and ‘inline-flex’ ‘display’ values
$default-flex-display: flex;