Skip to content

Instantly share code, notes, and snippets.

@tinbotu
tinbotu / script.rb.diff
Created August 14, 2012 14:43
fixing Gyazoed image scale with Macbook Pro Retina grows twice
--- /Applications/Gyazo.app/Contents/Resources/script~ 2012-08-14 07:50:01.000000000 +0900
+++ /Applications/Gyazo.app/Contents/Resources/script 2012-08-14 23:31:39.000000000 +0900
@@ -24,6 +24,7 @@
else
system "screencapture -i \"#{tmpfile}\""
if File.exist?(tmpfile) then
+ system "/usr/local/bin/mogrify -resize 50% -unsharp 1x1.2+0.2+0 \"#{tmpfile}\""
system "sips -d profile --deleteColorManagementProperties \"#{tmpfile}\""
end
end
@naoranger
naoranger / tenki.rb
Created August 9, 2012 02:52
nokogiri sample tenki
require 'nokogiri'
require 'open-uri'
url = "http://tenki.jp/"
doc = Nokogiri::HTML(open(url).read)
doc.xpath('//ul[@class="localList"]//li').each do |item|
# u = item.xpath('.//a').attribute('href')
puts item.xpath('.//a').text
# puts item.xpath('.//a/attribute::href').first
# puts item.search('a').attribute('href')
@rummelonp
rummelonp / faraday.md
Last active May 20, 2022 12:23
Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

Ruby の HTTP クライアントライブラリ Faraday が便利そう

API ラッパの開発には [RestClient gem][rest_client_gem] だとか
OAuth の必要なものは [Net/HTTP][net_http] + [OAuth gem][oauth_gem] を使ってた

[Twitter gem][twitter_gem] や [Instagram gem][instagram_gem] など API ライブラリのソースを読んでみると
[Faraday gem][faraday_gem] というものがよく使われてた

@sowawa
sowawa / README.md
Created April 25, 2012 17:14
Rackhub 2nd generation

Gist一枚でわかる、Rackhub 2nd generation!

「巷で人気?のプログラミング言語」をひと通りインストールした プログラマのためのホスティングサービスRackhubの環境の新バージョンをリリースしました。

前回からいくつかのアーキテクチャの変更を行い、より使いやすくて安定した環境をお手軽に使えるようになりました。 大きな変更は、これまではコンテナ型仮想化を使っていましたが KVMによるフルバーチャライズド環境になりました。 KVM自体は、もうめずらしくもなんともない技術なので特筆することはとくにないと思うのですが、コンテナ型環境の抱える問題との決別をという意味では、良い変更になったのではないかと思います。

@keikubo
keikubo / README.md
Created March 20, 2012 01:38
Nginx + Unicorn for Rails on Rackhub

Nginx + Unicorn for Rails on Rackhub

Description:

This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.

Installation:

Please make sure that your Gemfile in your rails application includes unicorn.

@cockscomb
cockscomb / ios_japanese_documents_downloader.rb
Last active September 30, 2015 15:37
iOS Developer Library の日本語ドキュメント PDF を一括ダウンロードする Ruby スクリプト。Ruby 1.9.x 対応。
#! /usr/bin/env ruby
# encoding: UTF-8
require 'uri'
require 'json'
require 'open-uri'
require 'openssl'
require 'nokogiri'
def get_documents_info()
@snatchev
snatchev / gist:1316470
Created October 26, 2011 14:08
resque worker devise not eager loading
❷ > QUEUE=* rake resque:work --trace
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Execute resque:setup
** Execute resque:preload
rake aborted!
No such file to load -- devise/confirmations_controller
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:306:in `rescue in depend_on'
/Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:301:in `depend_on'
@hetima
hetima / safari_cmenu_item_tags.txt
Created July 31, 2011 16:00
Safari 5.1 context menu item tags
戻る, 9
進む, 10
ページを再読み込み, 10018
Dashboard で開く..., 10031
-
ソースを表示, 10019
ページを別名で保存..., 10021
ページをプリント..., 10025
-
要素の詳細を表示, 2024
@dakatsuka
dakatsuka / chat.js
Created June 19, 2011 11:27
中継サーバに Redis Pub/Sub を使う
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What The Fuck You Want
// To Public License, Version 2, as published by Sam Hocevar. See
// http://sam.zoy.org/wtfpl/COPYING for more details.
var sys = require('sys')
, opts = require('opts')
, ws = require('websocket-server')
, redis = require('redis')
@bobpp
bobpp / com.github.mxcl.homebrew.daemontools.plist
Created February 13, 2011 06:47
daemontools at Mac OS X homebrew
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.mxcl.homebrew.daemontools</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/svscanboot</string>
</array>