Skip to content

Instantly share code, notes, and snippets.

echo "Building libplist..."
git clone http://cgit.sukimashita.com/libplist.git/ > /dev/null
cd libplist
mkdir build
cd build
cmake --prefix=/usr ..
make
sudo make install
cd ../../
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

ActiveRecord cheat sheet / EXAMPLES
INSTALL
=======
$ gem install activerecord
in GEMFILE: gem ‘activerecord’
REQUIRE
=======
require ‘active_record’
require 'rubygems'
require 'nokogiri'
require 'eeepub'
DOC_TITLE = 'Ruby on Rails Guides'
def get_pages(src_dir)
index_file = File.join(src_dir, 'index.html')
section = nil
pages = [{ :section => section, :title => DOC_TITLE, :path => index_file }]
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
#!/usr/bin/env bash
# Download HTML converted from provided Markdown, using GitHub API v3
##
md2html(){
if [[ $# -ne 2 ]]; then
echo "ERROR.\nSYNTAX: Markdown_To_HTML <markdown-filepath> <dest-html-filepath>"
return
fi
unset _markdown_filepath
@hafizio
hafizio / .agignore
Created August 19, 2014 04:31 — forked from fallwith/.agignore
/log/
/logs/
/images/
/javascripts/
/stylesheets/
/tmp/
/vendor/
*.sql
*.tags*
*.gemtags*
# Selection sort (very slow on large lists)
a = [9,8,6,1,2,5,4,3,9,50,12,11]
n = a.size - 1
n.times do |i|
index_min = i
(i + 1).upto(n) do |j|
index_min = j if a[j] < a[index_min]