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
omg = [1,2,3] | |
omg ===Array # => false | |
Array === omg # => true | |
omg.is_a? Array # => true | |
tmp = 1 | |
tmp.is_a? Array #=> false |
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
# Not suitble for production | |
require 'open-uri' | |
open('http://github.com') | |
require 'net/http' | |
require 'uri' | |
uri = URI.parse "http://github.com/" | |
response = Net::HTTP.get_response uri | |
# Use system call |
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
lambda { |*args| (args.first || default) } |
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
bar = [1,2,3] | |
for foo in bar: | |
foo = foo + 1 | |
break | |
print foo |
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
REM get date from MM/DD/YYYY | |
SET YEAR=%DATE:~6,4% | |
SET MONTH=%DATE:~0,2% | |
SET DAY=%DATE:~3,2% | |
SET DATENOW=%YEAR%%MONTH%%DAY% | |
REM get time from hh:mm:ss.ss | |
SET hh=%TIME:~0,2% | |
IF %hh% LSS 10 SET hh=0%hh:~1,1% | |
SET mm=%TIME:~3,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
class TestWorker | |
def startup | |
# Change process name | |
$PROGRAM_NAME = "HL7 - noop working..." | |
# Create pid file | |
File.open("tmp/pids/workers.pid", "a") {|f| f.puts Process.pid } | |
# Go daemon and disconnect from STDOUT/STDERR |
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
--- | |
driver: | |
name: docker | |
socket: <%= ENV['DOCKER_HOST'] %> | |
provisioner: | |
name: chef_zero | |
platforms: | |
- name: ubuntu-14.04 |
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
for f in *.conf | |
do | |
mv ${f}{,.erb} | |
done |
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
FROM ubuntu:14.04 | |
MAINTAINER Shunwen Hsiao, "https://github.com/shunwen" | |
RUN apt-get update | |
RUN apt-get install -qy git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common vim | |
RUN apt-get clean | |
# Install nodejs for js runtime | |
RUN add-apt-repository ppa:chris-lea/node.js |
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
# Activate the gem you are reporting the issue against. | |
gem 'activerecord', '4.1.1' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) |