Skip to content

Instantly share code, notes, and snippets.

View jugyo's full-sized avatar
🏠
Working from home

Kaz jugyo

🏠
Working from home
  • The League
  • New Jersey
View GitHub Profile
@jugyo
jugyo / gist:5386275
Last active December 16, 2015 05:39
AppleScript for LaunchBar which opens file in Sublime Text
on handle_string(theString)
do shell script "~/bin/subl " & theString
end handle_string
[0x304B, 0x3099].pack('U*')
#=> "が"
[0x304B, 0x3099].pack('U*').bytes
#=> [227, 129, 139, 227, 130, 153]
require 'unf'
#=> true
[0x304B, 0x3099].pack('U*').to_nfc
#=> "が"
[0x304B, 0x3099].pack('U*').to_nfc.bytes
#=> [227, 129, 140]
@jugyo
jugyo / GitCommitShow.py
Created March 16, 2013 08:55
git_commit_show command for Sublime Text
import sublime
from git import GitWindowCommand, plugin_file
class GitCommitShowCommand(GitWindowCommand):
def run(self):
if self.active_view() != None:
sha1 = self.active_view().substr(self.active_view().sel()[0])
if sha1 != "":
self.git_commit_show(sha1)
else:
#!/bin/sh
curl $* | python -mjson.tool
@jugyo
jugyo / file_name_on_status_bar.py
Created February 26, 2013 07:41
Sublime Text Plugin to show file name on status bar
import sublime_plugin
class FileNameOnStatusBar(sublime_plugin.EventListener):
def on_activated(self, view):
path = view.file_name()
if path:
for folder in view.window().folders():
path = path.replace(folder + '/', '', 1)
view.set_status('file_name', path)
else:
@jugyo
jugyo / Procfile
Last active December 13, 2015 21:39
Example of Sidekiq with Rails
worker: RAILS_ENV=production bundle exec sidekiq -C config/sidekiq.yml
@jugyo
jugyo / english.rb
Last active December 13, 2015 19:19
earthquake.gem plugin to show english tweets only
# Configuration
# -------------
#
# Earthquake.config[:english] = {
# ignore: /jugyo|yukihiro_matz/,
# highlight: /ruby|rails|sublime|git|twitter/i
# }
#
Earthquake.init do
_ = config[:english] ||= {}
class Array
def u
pack('U*')
end
end
class Fixnum
def u
[self].pack('U*')
end
@jugyo
jugyo / gist:4735072
Created February 7, 2013 23:10
rbenv install with readline etc
$ CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 1.9.3-p374
@jugyo
jugyo / api_logger.rb
Created February 7, 2013 02:39
earthquake.gem plugin
Earthquake.once do
require 'webmock'
require 'logger'
logger = Logger.new(File.join(Earthquake.config[:dir], 'api.log'))
WebMock.allow_net_connect!
WebMock.after_request do |request, response|
logger.info "#{request.method.upcase} #{request.uri} #{request.body}"
logger.info response.status.join(' ')
logger.info response.body
logger.info response.headers.map {|key, val| "#{key}: #{val}" }.join("\n")