Skip to content

Instantly share code, notes, and snippets.

View godfat's full-sized avatar

Lin Jen-Shin (godfat) godfat

View GitHub Profile
// clang++ -Wall -pedantic -std=c++11 -stdlib=libc++ bind.cpp
#include <iostream>
#include <functional>
using std::cout;
using std::endl;
using std::bind;
using std::placeholders::_1;
using std::placeholders::_2;
require 'bacon'
require 'rubyqc'
Bacon.summary_on_exit
Bacon::Context.include RubyQC::API
class User < Struct.new(:name, :gold)
def self.rubyqc
new(String.rubyqc, (0..99).rubyqc)
autocmd FileType vimfiler nmap <buffer> <enter> ToggleOrEnter()
function! ToggleOrEnter()
if vimfiler#get_file().vimfiler__is_directory
t
else
e
endif
endfunction
Tags = %w[ruby haskell c++ scala java c# js php agda idris julia ocaml]
module BestMatch
module_function
def distance_tags a, b
sum(a & b) / sum(a)
end
def sum tags
def f a={}, **b
[a, b]
end
# huh?
f({:a => 0}) # => [{}, {:a => 0}]
# as expected
f(0) # => [0, {}]
In reply to: https://twitter.com/plataformatec/status/525670283899072513
Hi,
This would probably be a long story, and I am not going to go
through all the details here. You're doing well in what
could be done, but in general, I oppose to build a user system
on top of some generic framework. The reason is that a user
system could be very specific to business logic, and it
could be very hard to customize devise in a way that works
# slow as hell:
require 'rubygems/gem_runner'
Gem::GemRunner.new.run(['install', gem_path])
# fast!
require 'rubygems/commands/install_command'
# read ~/.gemrc
Gem.use_paths(Gem.configuration[:gemhome], Gem.configuration[:gempath])
Gem::Command.extra_args = Gem.configuration[:gem]
00:02 ~/p/g/muack *master> mutant -Ilib -rmuack --use pork Muack
Mutant configuration:
Matcher: #<Mutant::Matcher::Config match_expressions=[<Mutant::Expression: Muack>] subject_ignores=[] subject_selects=[]>
Integration: pork
Expect Coverage: 100.00%
Jobs: 8
Includes: ["lib"]
Requires: ["muack"]
F.................................................F.......F...................Muack.reset:/Users/godfat/project/godfat/muack/lib/muack.rb:16
- pork:Muack
04:17 ~/p/g/muack adopt-pork-1.0.0> mutant -Ilib -rmuack --use pork Muack
Mutant configuration:
Matcher: #<Mutant::Matcher::Config match_expressions=[<Mutant::Expression: Muack>] subject_ignores=[] subject_selects=[]>
Integration: pork
Expect Coverage: 100.00%
Jobs: 8
Includes: ["lib"]
Requires: ["muack"]
..............................................................F.......................FFMuack.reset:/Users/godfat/project/godfat/muack/lib/muack.rb:16
- pork:Muack::IsAsatisfy
@godfat
godfat / install-rbx.sh
Last active August 29, 2015 14:10
rubinius on mac
sudo mv /usr/include/c++ /usr/include/c++.bak # avoid conflicting, might not be needed
brew install --HEAD ruby-install
brew tap homebrew/versions
brew install llvm35 --with-libcxx --with-clang --with-lld --all-targets --rtti
env CC=clang-3.5 CXX=clang++-3.5 CXXFLAGS=-stdlib=libc++ LDFLAGS='-L/usr/local/lib/llvm-3.5/usr/lib -lc++' ruby-install rbx -- --llvm-config llvm-config-3.5
sudo mv /usr/include/c++.bak /usr/include/c++ # restore g++ headers