- Ruby : 2.2.0
- Rails : 4.1.7
- backbone-on-rails : 1.1.2.0
- jQuery : 1.11.2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cal(expr) | |
while(true) | |
matched = /(\d+)(\*)(\d+)/.match(expr) | |
expr.gsub!(matched[0],"#{matched[1].to_i * matched[3].to_i}") if matched | |
matched = /(\d+)(\/)(\d+)/.match(expr) | |
return "Error!" if matched and matched[3] == "0" | |
expr.gsub!(matched[0],"#{matched[1].to_i / matched[3].to_i}") if matched | |
matched = /(\d+)(\+)(\d+)/.match(expr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########### | |
## Usage ## | |
# | |
# puts Scoreboard.score([[10,0],[10,0],[10,0],[8,2],[7,3],[9,1],[7,2],[3,0],[7,2],[6,3,0]]) | |
# puts Scoreboard.score([[10,0],[10,0],[10,0],[8,2],[7,3],[9,1],[7,2],[3,0],[7,2],[6,0],[3,0],[0,0]]) | |
# puts Scoreboard.score([10,10,10,8,2,7,3,9,1,7,2,3,0,7,2,6,3,0]) | |
# | |
########### | |
class Scoreboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# EDIT based on https://github.com/sarfata/voodooprivacy/blob/master/voodoo-vpn.sh | |
# | |
# voodoo-vpn.sh: Amazon EC2 user-data file for automatic configuration of a VPN | |
# on a Ubuntu server instance. Tested with 12.04. | |
# | |
# See http://www.sarfata.org/posts/setting-up-an-amazon-vpn-server.md | |
# | |
# DO NOT RUN THIS SCRIPT ON YOUR MAC! THIS IS MEANT TO BE RUN WHEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Task | |
attr_accessor :done_flg | |
def done? | |
done_flg | |
end | |
end | |
class TaskTest | |
test "done? returns true" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Opens the github page for a repo/branch in your browser. | |
# https://github.com/paulirish/git-open/ | |
# | |
# git open | |
# git open [remote] [branch] | |
# are we in a git repo? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ssh-multi.sh - a script to ssh multiple servers over multiple tmux panes | |
# usage: type tmux then from inside tmux type ssh-multi.sh HOST1 HOST2 ... HOSTN | |
# Muayyad Alsadi, D.Kovalov | |
# https://gist.github.com/muayyad-alsadi/bd25845776bb6b4185ba/ | |
# https://gist.github.com/dmytro/3984680 | |
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html | |
# Tested with Ubuntu 16.04 and tmux 2.1 | |
function error() { |