Skip to content

Instantly share code, notes, and snippets.

View azu's full-sized avatar

azu azu

View GitHub Profile
@iloveitaly
iloveitaly / screenshot_active_window.applescript
Created June 29, 2011 17:17
Take a Screenshot of the Frontmost / Active Window
-- Author: Michael Bianco
-- http://mabblog.com/
-- References:
-- http://stackoverflow.com/questions/1866912/applescript-how-to-get-current-display-resolution/6524651#6524651
-- http://macscripter.net/viewtopic.php?id=28958
on run argv
screenshot_active_window(item 1 of argv)
end run
@enaeher
enaeher / tiered_archives.rb
Created September 5, 2011 21:49
Tiered Archives plugin
# A quick and dirty plugin for Jekyll by Eli Naeher
#
# This plugin creates a site.years template variable which allow you to group archive links by year and month.
# The structure of site.years is:
# site.years = 2001=>[[post1, post2...], [...]], 2002=>[...]
#
# Usage should look something like this:
# {% for year in site.years %}
# <h2>Year {{ year.first.first.date | date: "%Y" }}</h2>
@jbroadway
jbroadway / Slimdown.md
Last active February 3, 2026 22:10
Slimdown - A simple regex-based Markdown parser.
@ukyo
ukyo / prototype.md
Last active October 6, 2015 11:57
About Javascript prototype

#プロトタイプと、あとクラス、継承、ミックスインと呼ばれている物の説明

この文書はなるべく正確な情報を書きたいのでちょくちょく更新されます。あと、ちょくちょくキャラが変わるのは気にしないでください。修正した部分に関する情報は コメント やリビジョンを参照してください。

プリミティブ型とオブジェクト型

Javascriptの変数にはプリミティブ型とオブジェクト型が存在する。

###プリミティブ型

@matthewp
matthewp / gist:3099268
Created July 12, 2012 16:50
XMLHttpRequest wrapped into a promise
function xhr(options) {
var deferred = Q.defer(),
req = new XMLHttpRequest();
req.open(options.method || 'GET', options.url, true);
// Set request headers if provided.
Object.keys(options.headers || {}).forEach(function (key) {
req.setRequestHeader(key, options.headers[key]);
});
@gereon
gereon / gist:3150445
Created July 20, 2012 12:20
Mac OSX Spotlight Enhancement

Mac OSX Spotlight Enhancement

Add this to Info.plist in /System/Library/Spotlight/RichText.mdimporter/Contents/ and Spotlight will search for source code files.

<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
public.c-plus-plus-source
@domenic
domenic / promises.md
Last active March 27, 2026 06:34
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@hayajo
hayajo / changelog_en.md
Last active March 18, 2026 16:53
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形

@amano41
amano41 / Rprofile.R
Last active October 5, 2018 06:51
.Rprofile
## CRAN ミラーを指定
options(repos=list(CRAN="https://cran.rstudio.com/"));
## 起動時にロードするパッケージを追加
local({
pkgs <- getOption("defaultPackages");
options(defaultPackages=c(pkgs, "lattice", "car"));
});
## 零和対比をデフォルトに設定
#!/bin/sh
# Update latest stable version, use it and migrate npm packages.
PREV_VER=$(nodebrew ls|grep current:|cut -d ' ' -f 2)
echo "Current version: $PREV_VER"
echo ""
echo "nodebrew install-binary stable"
nodebrew install-binary stable
if [ $? -ne 0 ]; then
# Already installed