Skip to content

Instantly share code, notes, and snippets.

View avyavya's full-sized avatar
💭
😇

ぁ^"^" avyavya

💭
😇
View GitHub Profile
@avyavya
avyavya / .zshrc
Created August 11, 2011 16:48
zsh completion matches LARGE char
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
@avyavya
avyavya / updatedb.sh
Created August 29, 2011 07:41
updatedb (osx)
#!/bin/sh
sudo /usr/libexec/locate.updatedb
@avyavya
avyavya / .gitconfig
Created September 2, 2011 03:26
git config ~/.gitconfig
[user]
name = name
email = name@example.com
[alias]
st = status
ci = commit
ls = list
co = checkout
[color]
ui = true
@avyavya
avyavya / gist:1599015
Created January 12, 2012 06:00
modify UIBarButtonItem background color
/** change UIBarButtonItem background color */
for (UIView *sv in [self subviews]) {
if ([sv respondsToSelector:@selector(setTintColor:)]) {
[sv performSelector:@selector(setTintColor:) withObject:[UIColor grayColor]];
}
}
@avyavya
avyavya / src.js
Created September 9, 2012 10:00
Hatena bookmark Bookmarklet for bookmarking from Pocket article view.
javascript:(function(){var%20url,title;if(location.host==="getpocket.com"){title=document.getElementsByTagName('h1')[0].textContent;url=document.getElementsByClassName('original')[0].childNodes[0].href;if(!title||!url)return;}else{title=document.title;url=location.href;}%20window.open('http://b.hatena.ne.jp/add?mode=confirm&is_bm=1&title='+escape(title)+'&url='+escape(url),'_blank','width=520,height=500,resizable=1,scrollbars=1');})()
@avyavya
avyavya / output
Created September 9, 2012 14:09
NSURL properties.
// vim: set ts=4 sts=4 sw=4 et nosi noai ft=objc :
// usage:
// $ clang -g -framework Foundation -o test test.m
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])
{
@autoreleasepool {
NSURL *url = [NSURL URLWithString:@"https://user:pass@www.google.com/foo/bar/baz.ext?q=query#hash"];
NSLog(@"%@", url);
@avyavya
avyavya / install-phpunit-submodule.sh
Created September 13, 2012 17:13
install phpunit dependencies as git submodule. without PEAR.
#!/bin/sh
# vim set: ts=2 sts=2 sw=2 et :
#
# install phpunit dependencies as git submodule.
#
# usage:
# clone phpunit and run.
# $ git clone git://github.com/sebastianbergmann/phpunit.git && cd phpunit
which git > /dev/null 2>&1
@avyavya
avyavya / src.js
Created September 16, 2012 07:41
Bookmarklet as play all embeddable youtube videos with embed player.
javascript:(function(){var%20embeds,iframes,links,ids,url;function%20getVideoId(nodes)%20{var%20i,j,match,attr,list=[],regex=[/http:\/\/([a-z]+\.)?youtube\.com\/v\/([-\w]+)/,/http:\/\/([a-z]+\.)?youtube\.com\/watch\?v=([-\w]+)/,/http:\/\/youtu\.be\/([-\w]+)/];loop:for(i=0;i<nodes.length;++i){if(nodes[i].src){attr=nodes[i].src;}else%20if(nodes[i].href){attr=nodes[i].href;}else{continue;}%20for(j=0;j<regex.length;++j){match=attr.match(regex[j]);if(match){list.push(match.pop());continue%20loop;}}}%20return%20list;}%20function%20unique(arr)%20{var%20i,uniq=[],d={};for(i=0;i<arr.length;++i){if(d[arr[i]]){continue;}%20uniq.push(arr[i]);d[arr[i]]=1;}%20return%20uniq;}%20embeds=getVideoId(document.getElementsByTagName('embed'));iframes=getVideoId(document.getElementsByTagName('iframe'));links=getVideoId(document.getElementsByTagName('a'));ids=unique(embeds.concat(iframes,links));if(!ids.length)return;url='http://youtube.com/v/'+ids.shift()+'?hd=1&autoplay=1&version=3&playlist='+ids.join(',');window.open(url,'YoutubeE
@avyavya
avyavya / build-gh-unit-ios-framework.sh
Created October 12, 2012 20:38
build script for GHUnitIOS.framework
#!/bin/sh
# vim: set sw=2 ts=2 sts=2 et :
#
# build script for GHUnitIOS.framework
#
SRC_DIR=/gh-unit
PROJ_DIR=/Project-iOS
# check gh-unit directory
@avyavya
avyavya / sh
Last active December 15, 2015 13:49
add submodules defined in .gitmodules
cat .gitmodules | awk '{print $3}' | grep '^.\+$' | sed 'N;s/\n/ /' | awk '{print "git submodule add " $2 " " $1}' | sh