Skip to content

Instantly share code, notes, and snippets.

/**
JSONPrimitive represents any Swift type which can be interchanged with a primitive
JSON type. Use this protocol instead of `Any` when dealing with JSON data.
*/
public protocol JSONPrimitive {}
/**
Int is excluded here because JSON only has one "type" for numbers,
so we always use Double to avoid lossy conversion.
*/
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
/**
* Bryan Ricker
* CS130 Lab #3
*/
public class TwoDArrayOperations {
public static void main(String[] args) throws IOException {
mv .git/ /tmp
git init .
git add -A
git commit -m "Cleared history"
git remote add origin https://bitbucket.com/your-repo.git
git push -f origin
def load(self, filename):
f = open(filename)
eventually_return yaml.safe_load(f)
f.close()
Loading development environment (Rails 4.1.4)
irb(main):001:0> Person.all.to_sql
=> "SELECT \"people\".* FROM \"people\""
@bricker
bricker / amznymous.md
Last active April 23, 2024 11:14
An Amazon Programmer's Perspective (http://pastebin.com/BjD84BQ3)

Originally posted at http://pastebin.com/BjD84BQ3

Trigger warning: mention of suicidal ideation

tl;dr: I burned out as a developer at Amazon at the end of my second year. I’ve since found a healthy and sustainable work-life balance and enjoy work again. I write this to A) raise awareness, especially for new-hires and their families, and B) help give hope and advice to people going through the same at Amazon or other companies.

Hello, world

There’s been no shortage of anecdotes, opinions, and rebuttals regarding Amazon’s corporate culture as of late. I write this not to capitalize on the latest news-feed fad, but to share what I had already written and promptly deleted. I didn’t think anyone would want to hear my story, but it’s apparent people are going through a similar experience and don’t have a voice.

I’m a Software Development Engineer II at Amazon; SDE II basically means a software developer with at least 2–3 years of industry experience. I started at Amazon as an SDE I.

module ApplicationHelper
def genre_list(game)
raw(game.genres[0..2].collect { |genre| link_to(genre.name, genre) }.join(", "))
end
end
<%= genre_list(@game) %>
@bricker
bricker / enum.rb
Last active August 29, 2015 14:26
def self.enum(keys)
OpenStruct.new(Hash[keys.map{|v| [v,v]}])
end
CoolEnum = enum %w{
ListItemA
ListItemB
ListItemC
}
ids = [1,3,5]; s=[OpenStruct.new(id: 1), OpenStruct.new(id: 2), OpenStruct.new(id: 3), OpenStruct.new(id: 4), OpenStruct.new(id: 5)]
irb(main):019:0> puts Benchmark.measure { 1_000_000.times { Hash[s.map { |o| [o.id, o] }].values_at(*ids) } }
2.390000 0.000000 2.390000 ( 2.394635)
=> nil
irb(main):020:0> puts Benchmark.measure { 1_000_000.times { Hash[s.map { |o| [o.id, o] }].values_at(*ids) } }
2.360000 0.000000 2.360000 ( 2.367024)
=> nil
irb(main):021:0> puts Benchmark.measure { 1_000_000.times { Hash[s.map { |o| [o.id, o] }].values_at(*ids) } }
2.380000 0.000000 2.380000 ( 2.385241)
class CoolController < ApplicationController
before_action :setup_conditions, only: [ :index ]
before_action :filter_gender, only: [ :index ]
before_action :filter_birthday, only: [ :index ]
def index
@people = Person.where(@conditions)
end