Skip to content

Instantly share code, notes, and snippets.

# Drop this file in config/initializers to run your Rails project on Ruby 1.9.
# This is three separate monkey patches -- see comments in code below for the source of each.
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects.
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9.
#
# Andre Lewis 1/2010
# encoding: utf-8
@bugcloud
bugcloud / common.sass
Created July 4, 2011 08:45
sass mixin functions
@mixin border-radius($radius:3px)
:-moz-border-radius $radius
:-webkit-border-radius $radius
:border-radius $radius
@mixin border-radius-left($radius:3px)
:border-top-left-radius $radius
:-moz-border-radius-topleft $radius
:-webkit-border-top-left-radius $radius
:border-bottom-left-radius $radius
@bugcloud
bugcloud / SlidableActivity.java
Created July 7, 2011 07:11
detecting slide on Android.
package com.bugcloud.android.slider;
import android.app.Activity;
import android.util.Log;
import android.view.MotionEvent;
public class SlidableActivity extends Activity {
protected static final String TAG = "SlidableActivity";
private static final int ACTION_TYPE_DEFAULT = 0;
private static final int ACTION_TYPE_UP = 1;
@bugcloud
bugcloud / bj.rb
Created August 12, 2011 04:48
make you hot
require 'net/http'
require 'uri'
BIJIN = "www.bijint.com"
now = Time.now
#puts "choose your favorite prefecture, jp/gal/hokkaido/sendai/kobe/kyoto/fukuoka/nagoya"
#pref = gets.chomp!
pref = "jp"
dir = "#{ENV['HOME']}/Desktop"
_g
class Hole
constructor: () ->
@SPRING = .1
@FRICTION = .9
@x = _g.document.width() / 2
@y = _g.document.height() / 2
@radius = 3
@radius2 = 14
@vec = {x: 100 * Math.random() - 50, y: 100 * Math.random() - 50}
@bugcloud
bugcloud / wb.coffee
Created December 9, 2011 10:11
Whiteboard from Google+ stream
streamsAll = []
streams = []
$("#contentPane .Sq>div").each () ->
streamsAll.push this
return undefined
oids = []
for st in streamsAll
a = $(st).find(".jr a:first")
oid = a.attr('oid')
@bugcloud
bugcloud / solarize.sh
Created February 19, 2012 11:18 — forked from codeforkjeff/solarize.sh
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
@bugcloud
bugcloud / glitchgifs.coffee
Created June 8, 2012 04:05
on{X}でロック解除時にランダムにGlitch画像を取得するアレ
class Tumblr
constructor: () ->
@offset = Math.floor(Math.random() * 10)
apiConsumerKey: "YOUR_KEY"
hostName: "glitchgifs.tumblr.com"
offset: 0
photoPostsCallback: (body, textStatus, response) ->
data = JSON.parse(body)
srcs = []
for post in data.response.posts
@bugcloud
bugcloud / summersonic-artist-search.js
Created June 12, 2012 04:35
http://www.summersonic.com/2012/lineup/ のアーティスト名のリンク先をYouTube検索に置換するブックマークレット
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$("#lineupList #listDate ul li").each(function(){var d=$(this).attr("class");if(d==""||d==null||d==undefined){var c=$(this).find("a:first");var b=c.find("img:first").attr("alt");c.attr("target","_blank").attr("href","http://www.youtube.com/results?search_query="+encodeURIComponent(b))}});});
@bugcloud
bugcloud / setup-chef
Created August 16, 2012 07:35
Setup chef with rvm to a clean Ubuntu Server
#!/bin/sh
sudo aptitude install build-essential zlib1g-dev libreadline6-dev libopenssl-ruby git curl wget
curl -L https://get.rvm.io | bash -s stable
echo 'source ~/.rvm/scripts/rvm' >> ~/.bashrc
export PATH=$PATH:$HOME/.rvm/bin
rvm pkg install openssl
rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr
rvm use 1.9.3
echo 'Unless you could run rvm use command, you should run these commands by yourself'