Skip to content

Instantly share code, notes, and snippets.

create_table :users, id: false do |t|
t.uuid :id, primary: true, null: false
# ...
end
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@hitode909
hitode909 / MouseJump.java
Created December 24, 2011 08:14
MouseJump
import java.util.Scanner;
import java.awt.AWTException;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.Robot;
public final class MouseJump
{
public static void main(String[] args) throws AWTException
{
@takkaw
takkaw / gist:1506221
Created December 21, 2011 14:28
earthquake.gem delete plug_in without id
Earthquake.init do
command :delete do
name = twitter.info["name"]
id = twitter.user_timeline(:screen_name => name).first["id_str"]
tweet = twitter.status(id)
async_e { twitter.status_destroy(id) } if confirm("delete '#{tweet["text"]}'")
end
end
@grantr
grantr / gist:1105416
Created July 25, 2011 22:31
Chef mysql master/slave recipes
## mysql::master
ruby_block "store_mysql_master_status" do
block do
node.set[:mysql][:master] = true
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password])
m.query("show master status") do |row|
row.each_hash do |h|
node.set[:mysql][:master_file] = h['File']
node.set[:mysql][:master_position] = h['Position']
end
# Install gcc44 package and update-alternatives (in chkconfig)
yum -y install gcc44 gcc44-c++
# Fixed in dep-selector-gecode 1.0.1
# Check if gcc is already a link
# if [ ! -L /usr/bin/gcc ]; then mv /usr/bin/gcc /usr/bin/gcc41; fi
# if [ ! -L /usr/bin/g++ ]; then mv /usr/bin/g++ /usr/bin/g++41; fi
# Install update-alteratives links for gcc41 and gcc44
# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc41 60 --slave /usr/bin/g++ g++ /usr/bin/g++41
# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc44 40 --slave /usr/bin/g++ g++ /usr/bin/g++44
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'kconv'
f = open(ARGV[0])
read = f.read
f.close
read = read.kconv(6, Kconv.guess(read))
read = read.gsub(/charset=[^"\s]+/i, "charset=utf-8")
read = read.gsub(/encoding="[^"\s]+"/i, "encoding=\"utf-8\"")
f = open(ARGV[0], "w")
# /bin/sh
if [ -z "$1" ];
then
echo "url parameter is required."
exit
fi
HOMEDIR="/home/oquno/tokindle"
SAVEDIR="${HOMEDIR}/savedpages"
KINDLEGEN="${HOMEDIR}/kindlegen"
RUBY="/usr/bin/ruby1.8"
# -*- coding: utf-8 -*-
$KCODE = 'UTF-8'
require 'rubygems'
require 'json'
require 'ya2yaml'
require 'oauth/cli/twitter' # gem install oauth-cli-twitter
BANNER = "usage ruby twitter_get_all_statuses.rb username path/to/file"
# TODO: 今何発言とったか表示できるようにする