Skip to content

Instantly share code, notes, and snippets.

View 2no's full-sized avatar
🤗

Kazunori Ninomiya 2no

🤗
View GitHub Profile
@tanakahisateru
tanakahisateru / shell-command-escape.coffee
Created August 26, 2014 11:15
Shell command escape by CoffeeScript
# replacement of node-shell-quote
# quote ['echo', '"Oh"', '>_<;'] # ==> echo '"Oh"' \>_\<\;
quote = (xs)->
(for s in xs
if /["\s]/.test(s) and !/'/.test(s)
"'" + s.replace(/(['\\])/g, '\\$1') + "'"
else if /["'\s]/.test(s)
'"' + s.replace(/(["\\$`(){}!#&*|])/g, '\\$1') + '"'
else
String(s).replace(/([\\$`(){}!#&*|<>;])/g, '\\$1')
cui vimでクリップボードを使う。
cUI vimの場合、+clipboardでコンパイルされないためクリップボード機能が使えないようです。
そんな時、fakeclipプラグインを使えば "*Y "*pなどでクリップボードが使えるようになり、他のアプリケーションと連携ができます。
いちいちマウスを触らなく良いので実にありがたい。
fakeclip => http://www.vim.org/scripts/script.php?script_id=2098
各種コマンドについてはvim-users.jpが参考になります。
http://vim-users.jp/2010/02/hack126/
@zonak
zonak / grunt_watch_usage.md
Created April 9, 2012 20:08
A usage scenario of the extended version of grunt.file.expandFiles

A usage scenario of the extended version of grunt.file.expandFiles that has the added feature of providing lists of:

  • all - set of all files matching the src definition of the task (default option)
  • changed - set of files matching the src definition of the task that have been changed since the last iteration of the watch task
  • deleted - set of files matching the src definition of the task that have been deleted since the last iteration of the watch task

The task execution would go something like this:

  • check for changed files:
@jugyo
jugyo / gist:3521894
Created August 30, 2012 02:56
Vagrant の使い方
@ahomu
ahomu / ajax_page.html
Created November 21, 2012 23:40
PhantomJSでStatic HTML生成するぞ君
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Ajax Page</title>
</head>
<body style="background-color: #fff;">
<h1>Ajax的にナニかするよー</h1>
<div id="content">
<p>loading...</p>
</div>
@konitter
konitter / grunt-roole.md
Last active December 13, 2015 22:19
Grunt(v0.4.0)でRoole自動化メモ

Grunt(v0.4.0)でRoole自動化メモ

第4のCSSプリプロセッサ「Roole」(v0.1.3)をGruntで自動化してみるメモ。
Rooleのgruntプラグインはまだないので、野良タスク(オリジナルのタスク)を作って直接rooleコマンドを叩く。

準備

こんな感じのpackage.jsonをプロジェクトディレクトリに用意。

@urakey
urakey / config.rb
Last active December 17, 2015 03:48
Snippet: Compass config.rb
# ************************************
# Environment Switch
# ************************************
# 開発モードか製品モードか指定(default :development)
# Gruntfile.js or Gruntfile.coffee に設定を書いている場合は不要
# environment = :production
# ************************************
# HTTP Path
@RubaXa
RubaXa / jquery.event.scroll.js
Last active December 17, 2015 06:58
jQuery extension, add support `scrollstart` and `scrollend` events.
/**
* jQuery extension, add support `scrollstart` and `scrollend` events.
*
* @author RubaXa <trash@rubaxa.org>
* @github https://gist.github.com/RubaXa/5568964
* @license MIT
*
*
* @settings
* $.special.scrollend.delay = 300; // default ms
@buritica
buritica / iosd
Created March 29, 2012 18:52
Enable Remote Inspector on Mobile Safari
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3 if found
[[ -d /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ ]] &&
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open iPhone Simulator on default location for XCode 4.2 if found
[[ -d /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ ]] &&
open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
@ChristianPeters
ChristianPeters / css_splitter.rake
Created August 8, 2011 10:22
Split CSS files so that there are no more than a given number of selectors in one style sheet. This is a tool to cope with Internet Explorer's limitation of max. 4095 selectors per stylesheet.
require 'rake'
require 'css_splitter'
desc 'split css files'
namespace :css do
task :split do
infile = ENV['infile'] || raise("missing infile")
outdir = ENV['outdir'] || File.dirname(infile)
max_selectors = ENV['max_selectors'] || 4095