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
# encoding: utf-8 | |
def test(a,b) | |
begin | |
result = ('テ'.encode(a) << 'テ'.encode(b)).encode('utf-8') | |
rescue Encoding::CompatibilityError | |
result = "FAILED!" | |
end | |
p "Example: #{a} + #{b}: #{result}" | |
end |
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
language: ruby | |
rvm: | |
- 1.9.3 | |
before_script: | |
- "export DISPLAY=:99.0" | |
- "sh -e /etc/init.d/xvfb start" | |
- bundle exec rackup ./test/config.ru 2>/dev/null & | |
- sleep 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
# (For developers) How to PROPERLY think about watching files and directories for changes | |
Goal: saving people the frustration of getting tools to "correctly" respond to | |
changes to files or directories. | |
## How to think about directories | |
Here's an example TODO file (/home/me/Documents/todo.txt): |
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
gem "rb-inotify" | |
require 'rb-inotify' | |
gem "listen" | |
require "listen" | |
dir = '.' | |
Listen.to(dir) do |modified, added, removed| | |
puts "listen: #{[added, modified, removed].inspect}!" |
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
# HOW TO USE: | |
# | |
# 1) save this to /some_path/lib/minitests/autorun.rb | |
# 2) run your test with RSpec, e.g. | |
# | |
# $ RUBYLIB=/some_path/lib rspec -f d test/hello_test.rb | |
require 'rspec/core' | |
require 'rspec/matchers' |
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
require 'rspec' | |
RSpec.configure do |config| | |
def stub_mod(mod, excluded) | |
mod.constants.each do |klass_name| | |
klass = mod.const_get(klass_name) | |
if klass.is_a?(Class) | |
unless klass == described_class | |
unless excluded.include?(klass) | |
class_double(klass.to_s).as_stubbed_const(transfer_nested_constants: true) |
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 ruby | |
require 'pathname' | |
ENV['BUNDLE_GEMFILE'] ||= (Pathname(__FILE__).realpath + '../../Gemfile').to_s | |
require 'rubygems' | |
require 'bundler/setup' | |
while !system(Gem.bin_path('guard', 'guard')) && $?.exitstatus == 2 | |
puts('Restarting guard...') |
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
``` | |
"NonBlockingInputStreamThread" daemon prio=10 tid=0x00007f55c4018800 nid=0x2294 in Object.wait() [0x00007f55fa726000] [153/516] | |
java.lang.Thread.State: WAITING (on object monitor) [152/516] | |
at java.lang.Object.wait(Native Method) [151/516] | |
- waiting on <0x00000000faca1e98> (a jline.internal.NonBlockingInputStream) [150/516] | |
at jline.internal.NonBlockingInputStream.run(NonBlockingInputStream.java:278) |
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
set(TUP_LABEL $ENV{TUP_LABEL}) | |
cmake_minimum_required(VERSION 3.2.2) | |
project(tup) | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_TEMP_STORE=2") | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_THREADSAFE=0") | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_OMIT_LOAD_EXTENSION") | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLUA_USE_MKSTEMP") |
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 ruby | |
#---------------------------------------------------------------------------- | |
# INFO: | |
# | |
# Simple script for web designers working on git repositories where source | |
# assets and compiled assets have to be stored in the same branch. | |
# | |
# The goal: generating assets safely and into a separate commit. | |
# |
OlderNewer