Skip to content

Instantly share code, notes, and snippets.

View srpouyet's full-sized avatar

Sebastiaan Pouyet srpouyet

View GitHub Profile
@srpouyet
srpouyet / bootstrap-osx-dev.sh
Last active October 26, 2022 07:33
Script to bootstrap osx for development
#!/usr/bin/env bash
# Bootstrap script for setting up a new OSX machine
# Adapted from a github gist by mrichman
# https://gist.github.com/mrichman/f5c0c6f0c0873392c719265dfd209e12
#
# This should be idempotent so it can be run multiple times.
# helpers
function echo_ok() { echo -e '\033[1;32m'"$1"'\033[0m'; }

Keybase proof

I hereby claim:

  • I am srpouyet on github.
  • I am srpouyet (https://keybase.io/srpouyet) on keybase.
  • I have a public key whose fingerprint is 6A75 7774 E8D2 770E DDB8 E9B6 849B 68F8 6340 8266

To claim this, I am signing this object:

@srpouyet
srpouyet / sequel_scopes.rb
Created August 31, 2018 14:25 — forked from odigity/sequel_scopes.rb
The Sequel Gem: Everything About Scopes
# (I recommend understanding the basics of this first: http://sequel.jeremyevans.net/rdoc/files/doc/object_model_rdoc.html)
# Extending the underlying dataset (http://sequel.jeremyevans.net/rdoc/files/README_rdoc.html#label-Extending+the+underlying+dataset)
# The recommended way to implement table-wide logic by defining methods on the dataset using dataset_module:
class Post < Sequel::Model
dataset_module do
def posts_with_few_comments
where{num_comments < 30}
@srpouyet
srpouyet / dataset.rb
Last active March 16, 2018 10:21
ROM Exact Online adapter
require "rom/http"
require "json"
require "uri"
require "faraday"
require "typhoeus"
require "typhoeus/adapters/faraday"
module ROM
module ExactOnline
DROP TABLE if exists d_date;
CREATE TABLE d_date
(
date_dim_id INT NOT NULL,
date_actual DATE NOT NULL,
epoch BIGINT NOT NULL,
day_suffix VARCHAR(4) NOT NULL,
day_name VARCHAR(9) NOT NULL,
day_of_week INT NOT NULL,
@srpouyet
srpouyet / brew_install_macvim.md
Created December 30, 2016 10:00
How to `brew install` Vim or Macvim with the Ruby version in the current PATH (set by chruby for example)

brew install with the option --env=std so the Ruby in the current PATH will be used while compiling (mac)vim.

brew install --env=std vim --with-custom-ruby  --with-override-system-vi --with-lua --with-luajit --with-mzscheme --with-tcl
brew install --env=std macvim --with-lua --with-luajit --with-python3 --HEAD

Keybase proof

I hereby claim:

  • I am srpouyet on github.
  • I am srpouyet (https://keybase.io/srpouyet) on keybase.
  • I have a public key whose fingerprint is 853D D65E B673 AA43 CEFA F883 5ADD D868 561A E4BD

To claim this, I am signing this object:

@srpouyet
srpouyet / throw_catch.rb
Created October 14, 2015 11:05
Fooling around with Ruby's throw - catch
def detector(jedi)
case jedi
when :anakin, :darth_vader
puts "I find your lack of faith disturbing."
throw :dark_side, jedi
when :dooku, :dark_tyranus
puts "There is a fine line between neutral and amoral. In fact, there may be no line there at all."
throw :dark_side, jedi
when :luke
puts "I'm Luke"
@srpouyet
srpouyet / RubyNext.tmLanguage
Last active December 6, 2017 22:51 — forked from edubkendo/RubyNext.tmLanguage
A better ruby syntax highlighter for sublime text. Combines the ruby bundle with ST, recent updates to the textmate bundle, and a tmLanguage file called "Experimental Ruby".
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>
TODO: unresolved issues
text:

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname