Skip to content

Instantly share code, notes, and snippets.

View yuki24's full-sized avatar
🔢
NaN :trollface:

Yuki Nishijima yuki24

🔢
NaN :trollface:
View GitHub Profile
@yuki24
yuki24 / android_in.css
Created November 3, 2010 12:08
I just wrote the droid only in CSS3.
body {
background: #30587c;
}
.white_border {
border: #fff solid 10px;
}
.left_horn_bg {
width: 26px;
@yuki24
yuki24 / gist:1187574
Created September 1, 2011 23:36 — forked from travis/gist:1084767
testing facebook connect with capybara and rspec
require 'mogli'
module FacebookIntegrationHelpers
shared_context "with unconnected facebook user" do
let(:fb_user) { create_test_user(installed: false) }
after { fb_user.destroy }
end
def app_client
Mogli::AppClient.new(AppConfig.facebook.access_token, AppConfig.facebook.app_id)
@yuki24
yuki24 / command_to_fix_the_gems.txt
Created September 14, 2011 03:23
fix for Invalid gemspec in [...../.gemspec]: Illformed requirement
# restore the gems that raised "Illformed requirement"
$ gem pristine selenium-webdriver
$ gem pristine cucumber
$ gem pristine multi_xml
$ gem pristine mogli
$ gem pristine httparty
$ gem pristine simplecov-html
$ gem pristine simplecov
@yuki24
yuki24 / apt_asking.txt
Created September 15, 2011 04:11
upgrading mongoDB to 2.0
Configuration file `/etc/mongodb.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** mongodb.conf (Y/I/N/O/D/Z) [default=N] ? D
@yuki24
yuki24 / create_db.sql
Created September 15, 2011 08:40
Useful Commands and SQLs for MySQL and Postgres
create database db_name;
GRANT ALL ON db_name.* TO db_name@localhost IDENTIFIED BY 'pass';
FLUSH PRIVILEGES;
@yuki24
yuki24 / dump_and_restore.sh
Created September 15, 2011 08:46
Useful Commands for MongoDB
# dump
mongodump --host localhost:27017 --db db_name --out /path/to/dump
# restore
mongod --port 27017 --drop --dbpath /path/to/dump
@yuki24
yuki24 / install_rvm_and_ruby192.sh
Created September 24, 2011 12:45
commands related to ruby installation
sudo apt-get install build-essential curl libreadline-dev libxslt-dev libxml2-dev libssl-dev git-core
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
rvm pkg install readline
rvm pkg install zlib
rvm pkg install openssl
rvm install 1.9.2 --with-openssl-dir=$HOME:/usr --with-zlib-dir=$HOME:/usr
rvm use 1.9.2 --default
@yuki24
yuki24 / out_redis.rb
Created October 16, 2011 09:42
fluent-plugin-redis 0.2.0 for fluentd 0.10.0
module Fluent
class RedisOutput < BufferedOutput
Fluent::Plugin.register_output('redis', self)
attr_reader :host, :port, :db_number, :redis
def initialize
super
require 'redis'
require 'msgpack'
end
@yuki24
yuki24 / str.rb
Created October 17, 2011 13:32
quick string examples
ruby-1.9.2-p290 :001 > %w{b k o n s u m t m t y m a i a i o y m n i}.length
=> 21
ruby-1.9.2-p290 :002 > "b k o n s u m t m t y m a i a i o y m n i".length
=> 41
ruby-1.9.2-p290 :003 > %w{b k o n s u m t m t y m a i a i o y m n i}
=> ["b", "k", "o", "n", "s", "u", "m", "t", "m", "t", "y", "m", "a", "i", "a", "i", "o", "y", "m", "n", "i"]
ruby-1.9.2-p290 :004 > %w{b k o n s u m t m t y m a i a i o y m n i}.class
=> Array
@yuki24
yuki24 / commands.sh
Created October 19, 2011 06:34
a set of useful commandlines
# find large files
sudo find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'