Skip to content

Instantly share code, notes, and snippets.

View fxposter's full-sized avatar

Pavlo fxposter

View GitHub Profile
class A
def to_s
'A1'
end
def to_str
'A2'
end
end
struct S;
impl S {
fn a(&self) {
println!("a");
}
fn b(&self) {
println!("b");
}
}
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: e76ae4e896d12e3fde7fd0c06eafe846e9160ea2
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.8.4-x86_64
Xcode: 4.6.3
CLT: 4.6.0.0.1.1365549073
GCC-4.2: build 5666
@fxposter
fxposter / gist:5077806
Created March 3, 2013 19:24
C++ GM clang fix
diff --git a/Makefile b/Makefile
index 186ef46..84c8dfd 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ all: pptoken
# build pptoken application
pptoken: pptoken.cpp IPPTokenStream.h DebugPPTokenStream.h
- g++ -g -std=gnu++11 -Wall -o pptoken pptoken.cpp
+ clang++ -g -std=c++11 -stdlib=libc++ -Wall -o pptoken pptoken.cpp
~/Projects/pa1 2 (master *) $ make
clang -g -std=c++11 -stdlib=libc++ -Wall -o pptoken pptoken.cpp
Undefined symbols for architecture x86_64:
"std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
std::__1::vector<std::__1::pair<int, int>, std::__1::allocator<std::__1::pair<int, int> > >::allocate(unsigned long) in pptoken-azXFj1.o
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initIPcEENS_9enable_ifIXsr21__is_forward_iteratorIT_EE5valueEvE4typeES9_S9_ in pptoken-azXFj1.o
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in pptoken-azXFj1.o
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::
describe PortChecker do
around :each do |block|
EventMachine.run(&block)
end
it 'succeeds immediately if port is open' do
success = false
failure = false
EventMachine.start_server('localhost', 11111)
t = Thread.new do
class A
sleep 10
def self.a
end
end
sleep 2
end
@fxposter
fxposter / Gemfile
Created April 19, 2012 11:40
Test environment for rails apps
group :development, :test do
gem 'rspec-rails', '~> 2.9' # rails generate rspec:install
gem 'factory_girl_rails'
end
group :test do
gem 'spork-rails' # spork rspec --bootstrap
gem 'capybara'
gem 'launchy'
gem 'timecop'
@fxposter
fxposter / gist:1391475
Created November 24, 2011 14:34
Haml to ERB converter
require 'haml'
class ErbEngine < Haml::Engine
def push_script(text, preserve_script, in_tag = false, preserve_tag = false,
escape_html = false, nuke_inner_whitespace = false)
push_text "<%= #{text.strip} %>"
end
def push_silent(text, can_suppress = false)
push_text "<% #{text.strip} %>"
module Api
extend self
def repository(owner, name)
fetch("repos/show/#{owner}/#{name}")['repository']
end
def organization(name)
fetch("organizations/#{name}/public_members")
end