Skip to content

Instantly share code, notes, and snippets.

View omoshetech-t's full-sized avatar

Takuya Tsuchida omoshetech-t

View GitHub Profile
@omoshetech-t
omoshetech-t / Set bounds for Safari.scpt
Last active February 2, 2017 00:53
Set bounds of the front window for Safari
tell application "Safari" to set bounds of the front window to {0, 0, 1280, 720}
@omoshetech-t
omoshetech-t / .vimrc
Last active February 1, 2017 13:43
.vimrc for OS X
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
set expandtab
set hlsearch
set shiftwidth=4
set softtabstop=4
set tabstop=4
nnoremap <Esc><Esc> :nohlsearch<CR>
@omoshetech-t
omoshetech-t / .bash_profile
Last active February 7, 2017 11:46
.bash_profile for OS X
export CLICOLOR=
export GREP_OPTIONS="--color=auto"
export HISTSIZE=
export HISTTIMEFORMAT="%F %T "
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
if type __git_ps1 > /dev/null 2>&1; then
PROMPT_COMMAND="__git_ps1 '\h:\W \u' '\\\$ '; $PROMPT_COMMAND"
GIT_PS1_SHOWDIRTYSTATE=true
@omoshetech-t
omoshetech-t / seo_keywords.rb
Last active September 8, 2015 11:19
Japanese SEO keyword suggestion tool.
require 'json'
require 'open-uri'
def complete(query)
q = URI.escape(query)
url = "http://suggestqueries.google.com/complete/search?q=#{q}&client=firefox&hl=ja"
json = open(url).read
JSON.parse(json).last
end
@omoshetech-t
omoshetech-t / app.js
Created September 1, 2015 20:44
Example of avoiding sequential Callback Hell with Ext JS.
var hello, world;
fetch('hello.json')
.then(function(response) {
hello = getMessage(response);
return fetch('world.json');
})
.then(function(response) {
world = getMessage(response);
Ext.Msg.alert('Success', hello + world);
@omoshetech-t
omoshetech-t / app.js
Created September 1, 2015 20:43
Example of avoiding Callback Hell with Ext JS.
Ext.Deferred.all([fetch('hello.json'), fetch('world.json')])
.then(function(responses) {
var hello = getMessage(responses[0]),
world = getMessage(responses[1]);
Ext.Msg.alert('Success', hello + world);
})
.otherwise(function(response) {
var error = getMessage(response);
Ext.Msg.alert('Failure', error);
});
@omoshetech-t
omoshetech-t / app.js
Created August 25, 2015 17:54
Example of Callback Hell with Ext JS.
Ext.Ajax.request({
url: 'hello.json',
success: function(response, opts) {
var hello = getMessage(response);
Ext.Ajax.request({
url: 'world.json',
success: function(response, opts) {
var world = getMessage(response);
Ext.Msg.alert('Success', hello + world);
},
@omoshetech-t
omoshetech-t / Open in Terminal.scpt
Created March 5, 2015 18:12
Open a specific folder in the Terminal.app.
on run {input}
set command to "cd " & POSIX path of input
tell application "Terminal"
if application "Terminal" is running then
activate
do script command
else
launch
activate
do script command in window 1
@omoshetech-t
omoshetech-t / gist-gadget.xml
Last active September 5, 2016 15:04
Google gadget for embedding Gist.
<?xml version="1.0"?>
<Module>
<ModulePrefs title="Gist">
<Require feature="dynamic-height"/>
</ModulePrefs>
<UserPref name="id" display_name="Gist ID" required="true" default_value="10683373"/>
<UserPref name="font_size" display_name="Font size (px)" required="true" default_value="12"/>
<UserPref name="line_height" display_name="Line height (px)" required="true" default_value="16"/>
<Content type="html">
<![CDATA[
@omoshetech-t
omoshetech-t / Add the "Perfect" equalizer preset to iTunes.scpt
Created February 18, 2014 18:14
Add the "Perfect" equalizer preset to iTunes.
tell application "iTunes"
-- Check existence of the "Perfect" equalizer preset
repeat with preset in EQ presets
if name of preset is "Perfect" then
return
end if
end repeat
-- Add the "Perfect" equalizer preset