Skip to content

Instantly share code, notes, and snippets.

View TrevorS's full-sized avatar

Trevor Strieber TrevorS

View GitHub Profile
@TrevorS
TrevorS / git-tree-alias.sh
Created March 27, 2014 14:47
git tree alias.
git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"
@TrevorS
TrevorS / resque.rake
Created February 27, 2014 16:24
Add Resque and Resque scheduler rake tasks.
require 'resque/tasks'
require 'resque_scheduler/tasks'
def run_worker(queue, count = 1)
puts "Starting #{count} Resque worker(s) with QUEUE: #{queue}."
ops = { pgroup: true, err: [Rails.root.join('log', 'workers_error.log'), 'a'],
out: [Rails.root.join('log', 'workers.log'), 'a']}
env_vars = { 'QUEUE' => queue.to_s }
count.times do
@TrevorS
TrevorS / json_map_builder.ex
Created January 18, 2016 01:56 — forked from rcdilorenzo/json_map_builder.ex
Convert a elixir json-decoded object to a map no matter how deep
defmodule JSONMapBuilder do
def to_map(list) when is_list(list) and length(list) > 0 do
case list |> List.first do
{_, _} ->
Enum.reduce(list, %{}, fn(tuple, acc) ->
{key, value} = tuple
Map.put(acc, binary_to_atom(key), to_map(value))
end)
_ ->
list
@TrevorS
TrevorS / casesafe.sh
Created January 4, 2018 18:55 — forked from scottsb/casesafe.sh
Create and manage a case-sensitive disk-image on macOS (OS X).
#!/bin/bash
# ---------------------------------------------------------
# Customizable Settings
# ---------------------------------------------------------
MOUNT_POINT="${CASE_SAFE_MOUNT_POINT:-${HOME}/casesafe}"
VOLUME_PATH="${CASE_SAFE_VOLUME_PATH:-${HOME}/.casesafe.dmg.sparseimage}"
VOLUME_NAME="${CASE_SAFE_VOLUME_NAME:-casesafe}"
VOLUME_SIZE="${CASE_SAFE_VOLUME_SIZE:-60g}"
#! /usr/bin/env ruby
require 'httparty'
require 'csv'
GROUP_ID = 'PUT THE GROUP ID HERE'
BEFORE_ID = 'PUT THE LAST MESSAGE BEFORE ID HERE'
class GroupMe
include HTTParty
@TrevorS
TrevorS / angularjs_directive_attribute_explanation.md
Created August 9, 2016 23:28 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@TrevorS
TrevorS / fix.sh
Created April 28, 2015 22:49
fix permissions in a Rails application
find . -type f ! -path "./.git/*" ! -path "./bin/*" -perm 755 -exec chmod 644 {} \;
@TrevorS
TrevorS / steve_on_jobs.txt
Created January 21, 2014 19:52
Steve Wozniak on Jobs
Steve WozniakAug 19, 2013+270898
Actually, the movie was largely a lie about me. I was an engineer at HP designing the iPhone 5 of the time, their scientific calculators. I had many friends and a good reputation there. I designed things for people all over the country, for fun, all the time too, including the first hotel movie systems and SMPTE time code readers for the commercial video world. Also home pinball games. Among these things, the Apple I was the FIFTH time that something I had created (not built from someone else's schematic) was turned into money by Jobs. My Pong game got him his job at Atari but he never was an engineer or programmer. I was a regular member at the Homebrew Computer Club from day one and Jobs didn't know it existed. He was up in Oregon then. I'd take my designs to the meetings and demonstrate them and I had a big following. I wasn't some guy nobody talked to, although I was shy in social settings. i gave that computer design away for free to help people who were espousing the t
Compiled from "Test.java"
public class Test {
public Test();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
public class Test {
public static void main(String[] args) {
// Primitives
int a = 10;
int b = 10;
System.out.println("a: " + a); // 10
System.out.println("b: " + b); // 10
System.out.println("a == b: " + (a == b)); // true