Skip to content

Instantly share code, notes, and snippets.

Takuya Tsuchida omoshetech-t

View GitHub Profile
@omoshetech-t
omoshetech-t / Set bounds for Safari.scpt
Last active Feb 2, 2017
Set bounds of the front window for Safari
View Set bounds for Safari.scpt
tell application "Safari" to set bounds of the front window to {0, 0, 1280, 720}
@omoshetech-t
omoshetech-t / .vimrc
Last active Feb 1, 2017
.vimrc for OS X
View .vimrc
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 Feb 7, 2017
.bash_profile for OS X
View .bash_profile
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 Sep 8, 2015
Japanese SEO keyword suggestion tool.
View seo_keywords.rb
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 Sep 1, 2015
Example of avoiding sequential Callback Hell with Ext JS.
View app.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 Sep 1, 2015
Example of avoiding Callback Hell with Ext JS.
View app.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 Aug 25, 2015
Example of Callback Hell with Ext JS.
View app.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 Mar 5, 2015
Open a specific folder in the Terminal.app.
View Open in Terminal.scpt
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 Sep 5, 2016
Google gadget for embedding Gist.
View gist-gadget.xml
<?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 Feb 18, 2014
Add the "Perfect" equalizer preset to iTunes.
View Add the "Perfect" equalizer preset to iTunes.scpt
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
You can’t perform that action at this time.