View coreos-openstack
1 2 3 4 5 6 7 8 9 10
# https://coreos.com/docs/running-coreos/platforms/openstack/
 
Step one:
 
```
$ wget http://alpha.release.core-os.net/amd64-usr/current/coreos_production_openstack_image.img.bz2
$ bunzip2 coreos_production_openstack_image.img.bz2
$ glance image-create --name CoreOS \
--container-format bare \
--disk-format qcow2 \
View panamax-coreos-installer.sh
1 2 3 4 5 6
mkdir panamax
cd panamax
curl -O http://download.panamax.io/installer/pmx-installer-latest.zip
unzip pmx-installer-latest.zip
sudo su
./coreos install --stable
View method_missing.js
1 2 3 4 5 6 7 8 9 10
// This will only work in environments that support ES6 Proxies.
// As of right now, that's pretty much only Firefox.
 
function Refrigerator(foods) {
 
this.foods = foods;
 
return new Proxy(this, {
get: function (receiver, name) {
if (name in receiver) {
View capybara cheat sheet
1 2 3 4 5 6 7 8 9 10
=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')
View advanced-style-ruby
1 2 3 4 5 6
def triangle(a, b, c)
raise TriangleError if [a,b,c].min <= 0
x, y, z = [a,b,c].sort
raise TriangleError if x + y <= z
[:equilateral,:isosceles,:scalene].fetch([a,b,c].uniq.size - 1)
end
View common-style-ruby
1 2 3 4 5 6 7 8 9 10
def triangle(a, b, c)
if a == 0 || b == 0 || c == 0
raise TriangleError
end
if((a+b < c) || (a+c < b) || (b+c < a))
raise TriangleError
end
if a == b && b == c # && a == c
:equilateral
elsif a == b || b == c || c == a
View tiny-rss-openshift-setup.md
  1. 下载tiny-tiny-rss source code
cd ~/src/git 
clone git://github.com/gothfox/Tiny-Tiny-RSS.git
  1. 创建openshift空间
View gist:952663
1 2 3 4 5 6 7 8 9
upstream tumblr {
server 72.32.231.8:80;
}
 
server {
listen 80;
server_name jyorr.com;
 
access_log /var/log/nginx/jyorr.access.log;
View gist:924997
1 2 3 4 5 6 7 8 9 10
class SvgController < ApplicationController
require 'active_support/secure_random'
def create
# create an SVG image
# based on Highcharts index.php
batik_path = Rails.root.to_s() + '/vendor/batik/batik-rasterizer.jar'
svg = params[:svg]
filename = params[:filename].blank? ? "chart" : params[:filename]
Something went wrong with that request. Please try again.