Skip to content

Instantly share code, notes, and snippets.

View tochman's full-sized avatar
💭
Coding on my own SaaS project (Rails + React)

Thomas Ochman tochman

💭
Coding on my own SaaS project (Rails + React)
View GitHub Profile
@tochman
tochman / factory_girl_strategy_find_or_create.rb
Created December 17, 2019 11:07 — forked from hiasinho/factory_girl_strategy_find_or_create.rb
FactoryGirl strategy for adding find & find_or_create
## http://stackoverflow.com/questions/7145256
module FactoryBot
module Strategy
class Find
def association(runner)
runner.run
end
def result(evaluation)
build_class(evaluation).where(get_overrides(evaluation)).first
@tochman
tochman / bullshit.js
Created November 25, 2019 21:11 — forked from raydog/bullshit.js
Bullshit as a Service
var E_PREFIX_RATE = 0.25;
// All of our word lists:
var _word_lists = {
verb : [
"implement", "utilize", "integrate", "streamline", "optimize", "evolve", "transform", "embrace",
"enable", "orchestrate", "leverage", "reinvent", "aggregate", "architect", "enhance", "incentivize",
"morph", "empower", "envisioneer", "monetize", "harness", "facilitate", "seize", "disintermediate",
@tochman
tochman / es-semaphore.sh
Last active November 24, 2019 22:34 — forked from jtadeulopes/es-semaphore.sh
A script for installing ES on SemaphoreCI
#! /usr/bin/env bash
## Usage:
## wget https://gist.githubusercontent.com/jtadeulopes/ae1f1ffe53000012b27b1112aecaa4b7/raw/45f792729d8b26e42f07028d0693e4de51024383/es-semaphore.sh && bash es-semaphore.sh <es-version>
##
ES_HOST="0.0.0.0"
ES_PORT="9200"
ES_VERSION=${1:-'5.0.0'}
DEB='elasticsearch-'"$ES_VERSION"'-amd64.deb'
@tochman
tochman / prawn_wrapped.rb
Created November 23, 2019 15:15 — forked from jlsync/prawn_wrapped.rb
How to prevent prawn wrap_by_char? charred.pdf
#!/usr/bin/env ruby
require 'rubygems'
require 'prawn'
@pdf = Prawn::Document.new
x = 0
texts = [ "alexander", "the alexander", "the alexander building" ]
texts.each do |text|

We will take a look a git bisect from a practical perspective. This will be a very simple demo, but should at least show you how this tool can help you to track down erroneous code in your git history. Let's create a new folder (name it bisect_demo) and create a series of commits.

git init
echo "Space, the final frontier" > monologue.txt
git add ./monologue.txt && git commit -am "first line"
echo "These are the voyages of the Starship Enterprise" >> monologue.txt && git commit -am "second line"
echo "Its five years mission" >> monologue.txt && git commit -am "third line"
echo "To explore strange new worlds" >> monologue.txt && git commit -am "fourth line"
echo "To seek out new life" &gt;&gt; monologue.txt &amp;&amp; git commit -am "fifth line"
@tochman
tochman / semaphore-es.sh
Last active May 29, 2018 18:49 — forked from BlackFoks/semaphore-es.sh
A script for installing ES on SemaphoreCI
#!/bin/bash
# Install a custom ElasticSearch version - https://www.elastic.co/products/elasticsearch
#
# To run this script on SemaphoreCI, add the following command to your project's build setup:
# \curl -sSL <RAW_URL_FOR_THIS_SCRIPT> | bash -s
#
ELASTICSEARCH_VERSION="6.2.4"
ELASTICSEARCH_PORT="9250"
ELASTICSEARCH_DIR="$SEMAPHORE_PROJECT_DIR/elasticsearch"
ELASTICSEARCH_WAIT_TIME="15"

Star Wars API with Babel Standalone

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My Page</title>
</head>
<body>
<h1>HEADING</h1>
@tochman
tochman / rails_5.md
Last active March 8, 2018 22:35
New Room Challenge - Storage using Active Storage
@tochman
tochman / auth.rb
Last active February 14, 2018 14:58
#app/controllers/auth.rb
class SlowFoodApp
get '/login' do
end
get '/signup' do
end
end