Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / gist:4412635
Created December 30, 2012 12:35
# Extract Service Object
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
rvm requirements
rvm install 2.0.0
source /etc/profile.d/rvm.sh
gem install chef ruby-shadow --no-ri --no-rdoc
@potomak
potomak / _flash.html.erb
Created January 12, 2012 14:35
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@audreyt
audreyt / moe.pl
Last active October 2, 2016 17:03
簡單的 ~/bin/moe 命令列搜尋器。
#!/usr/bin/env perl
use constant MoeDatabase => "$ENV{HOME}/w/newdict/development.sqlite3";
for my $arg (@ARGV) {
my $col = 'title';
if ($arg =~ /%$/) {
$arg = "%$arg";
$col = 'def';
}
$arg .= '%' unless $arg =~ s/\$$//;
system sqlite3 => MoeDatabase, qq[
@dandorman
dandorman / fabrication_feature_pool_spec.rb
Created August 9, 2011 23:00
FactoryGirl vs. Fabrication
require 'spec_helper'
describe FeaturePool do
it "creates a new instance given valid attributes" do
Fabricate :feature_pool
end
it "is not valid without a name" do
Fabricate.build(:feature_pool, :name => "").should_not be_valid
end
@parkr
parkr / generator_scss.rb
Created June 5, 2012 13:19
Jekyll Plugin to output SCSS without requiring the "---" YAML Front Matter
#
# Jekyll Generator for SCSS
#
# (File paths in this description relative to jekyll project root directory)
# Place this file in ./_plugins
# Place .scss files in ./_scss
# Compiles .scss files in ./_scss to .css files in whatever directory you indicated in your config
# Config file placed in ./_sass/config.rb
#
@jorilallo
jorilallo / Github's usage of the showdown.js in example
Created October 13, 2011 01:16
Showdown.js with GitHub Flavored Markdown
$(function() {
var converter = new Showdown.converter();
$("#user_input").keyup(function(){
var txt = $("#user_input").val();
var html = converter.makeHtml(txt);
$("#result").html(html)
$("#html_result").val(html.replace(/>/g, ">\n").replace(/</g, "\n<").replace(/\n{2,}/g, "\n\n"));
});
var sample = "#### Underscores\nthis should have _emphasis_\nthis_should_not\n_nor_should_this\n\n\
@matthutchinson
matthutchinson / launch_instance.rb
Created January 23, 2012 15:10
Launching EC2 instance with aws-sdk gem
#!/usr/bin/ruby
# README
# gem install aws-sdk
# add this to bashrc
# export HT_DEV_AWS_ACCESS_KEY_ID=????
# export HT_DEV_AWS_SECRET_ACCESS_KEY=????
# put your pem file in ~/.ssh and chmod 0400
# for more info see; https://rubygems.org/gems/aws-sdk
@cotsog
cotsog / .travis.yml
Created July 31, 2015 16:09
.travis.yml for gcc-5 compiler support on Travis CI
sudo: required
script:
- sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc
- gcc --version
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
@drewlustro
drewlustro / KeyboardViewController.swift
Created October 21, 2014 06:40
KeyboardViewController.swift source from AppDesignVault with AutoLayout constraints fixed.
//
// KeyboardViewController.swift
// Demo Custom Keyboard
//
// Created by Drew Lustro on 10/20/14.
//
// Original derived from tutorial found on AppDesignVault
// http://www.appdesignvault.com/ios-8-custom-keyboard-extension/
//
//