Skip to content

Instantly share code, notes, and snippets.

View zetavg's full-sized avatar

Pokai Chang zetavg

View GitHub Profile
function bind(a, b) {
return function () {
b.apply(a, arguments)
}
}
function loadJSON(a, b) {
var c = new XMLHttpRequest;
c.open("GET", a), c.onreadystatechange = function () {
4 == c.readyState && b.call(null, JSON.parse(c.responseText))
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active July 19, 2025 17:20
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@jofralogo
jofralogo / responsiveMixinsF4.sass
Last active December 15, 2015 21:18
Useful responsive SCSS mixins for Foundation 4.
/*
_______
These simple SCSS/SASS mixins for Foundation 4 are made by me to deal with media-queries and have a clean code at the same time! ;)
****IMPORTANT****
Due to Foundation 4 uses mobile-first methodology, every $phone-"X" variable in these mixins defines the value for every screen size.
$desktop-"X" values overrides $phone-"X" values when the width of the window is 768px and above.
@audreyt
audreyt / moe.pl
Last active October 2, 2016 17:03
簡單的 ~/bin/moe 命令列搜尋器。
#!/usr/bin/env perl
use constant MoeDatabase => "$ENV{HOME}/w/newdict/development.sqlite3";
for my $arg (@ARGV) {
my $col = 'title';
if ($arg =~ /%$/) {
$arg = "%$arg";
$col = 'def';
}
$arg .= '%' unless $arg =~ s/\$$//;
system sqlite3 => MoeDatabase, qq[
@ronnywang
ronnywang / gist:4235151
Created December 7, 2012 18:08
各地址登記公司數量
38 高雄市鳥松區
39 臺北市中山區南京東路3段101號4樓
40 臺中市清水區
40 臺北市中山區南京東路3段189號8樓
41 嘉義市西區磚
41 臺北市大安區忠孝東路4段285號5樓
42 臺北市中山區南京東路3段189號10樓
42 臺北市信義區光復南路495號
43 臺北市松山區敦化北路167號17樓
44 臺北市信義區忠孝東路4段560號10樓之2
@naaman
naaman / vim-on-heroku.sh
Last active July 6, 2023 13:50
vim on heroku
#!/usr/bin/env bash
mkdir vim
curl https://s3.amazonaws.com/heroku-vim/vim-7.3.tar.gz --location --silent | tar xz -C vim
export PATH=$PATH:/app/vim/bin
@khalsah
khalsah / deploy.sh
Created January 3, 2012 22:59
Experimental git sync & deploy hooks
#!/bin/sh
LOCAL_BRANCH="master"
LIVE_BRANCH="live"
REMOTE_NAME="deploy"
if [ "$(git symbolic-ref -q HEAD)" != "refs/heads/${LOCAL_BRANCH}" ]; then
echo "Not on ${LOCAL_BRANCH}, not deploying"
exit 1
else
@enriqueaf
enriqueaf / gist:1317935
Created October 26, 2011 21:28
First try for middleman and pjax
paths_for_url('/guides/*').each do |url|
get(url) do |p|
page "/pjax/guides/#{p}", :proxy=>"/guides/#{p}",:layout=>"pjax"
end
end
@cnruby
cnruby / install ncurses on macosx
Created May 7, 2011 09:05
HOW TO INSTALL ncurses on MacOSX
$ curl -O ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
$ tar -xzvf ncurses-5.9.tar.gz
$ cd ./ncurses-5.9
$ ./configure --prefix=/usr/local \
--without-cxx --without-cxx-binding --without-ada --without-progs --without-curses-h \
--with-shared --without-debug \
--enable-widec --enable-const --enable-ext-colors --enable-sigwinch --enable-wgetch-events \
&& make
$ sudo make install
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')