Skip to content

Instantly share code, notes, and snippets.

View rainkinz's full-sized avatar
🏠
Working from home

Brendan Grainger rainkinz

🏠
Working from home
View GitHub Profile
@rainkinz
rainkinz / gist:1193197
Created September 4, 2011 17:40
Mongoid failing many to many spec
require 'spec_helper'
describe Mongoid::Relations::Referenced::ManyToMany do
before(:all) do
Mongoid.raise_not_found_error = true
end
before do
[
@rainkinz
rainkinz / gist:2925769
Created June 13, 2012 18:53
Ruby Pipes
#/usr/bin/env ruby
# encoding: utf-8
APP_ROOT=File.expand_path('../../', __FILE__)
class Chain
def initialize(*procs)
@chain = procs
end
@rainkinz
rainkinz / gist:5645139
Last active December 17, 2015 17:19
Probably a really bad example of counting terms and enumerating their positions in documents.
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.Version;

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

2014-10-25 16:00:53 -0400
./configure
--disable-debug
--disable-dependency-tracking
--prefix=/usr/local/Cellar/rtorrent/0.9.4_1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/private/tmp/rtorrent-uS8ouH/rtorrent-0.9.4/missing: Unknown `--is-lightweight' option
2014-12-05 12:38:36 -0500
make
CMAKE_BUILD_TYPE=RelWithDebInfo
CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH=/usr/local/Cellar/neovim/HEAD"
install
mkdir -p .deps/build/third-party
cd .deps/build/third-party && \
cmake -G 'Unix Makefiles' \
@rainkinz
rainkinz / gist:05873fb5dbd8d1ce5959
Created March 21, 2015 19:56
setTimeout using libuv and therubyracer
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'v8'
require 'libuv'
require 'pry'
# class Global
@rainkinz
rainkinz / knife cheat
Created December 21, 2015 21:27 — forked from ipedrazas/knife cheat
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@rainkinz
rainkinz / SchemaTester.java
Created April 8, 2016 19:26 — forked from karthikshiraly/SchemaTester.java
Function testing for Solr 1.4 schema.xml
/*
This class uses Solr 1.4 classes to load its schema.xml and run input text through the analyzers defined
in it.
*/
public class SchemaTester {
public static void main(String[] args) {
try {
InputStream solrCfgIs = new FileInputStream(
"solr/conf/solrconfig.xml");
SolrConfig solrConfig = new SolrConfig(null, solrCfgIs);