Skip to content

Instantly share code, notes, and snippets.

@carolineartz
carolineartz / basic_query.csv
Created March 5, 2017 03:13 — forked from mdeland/basic_query.csv
Summarizing Data in SQL
date num_customers distinct_customers total_bananas total_revenue revenue_per_sale
2016-01-01 345 287 564 3689 6.54
2016-01-02 364 299 582 4080 7.01
... ... ... ... ... ...
package com.crowdlab.deserializers;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
public class DeserializerHelper {
private JsonObject mJsonObject;
public DeserializerHelper(JsonObject obj) {
@carolineartz
carolineartz / documents.rb
Last active July 19, 2019 16:44 — forked from dhh/documents.rb
dhh Rails resource example
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@carolineartz
carolineartz / ticket.rb
Created February 13, 2016 00:03 — forked from dhh/ticket.rb
class Ticket < ActiveRecord::Base
belongs_to :grouper
belongs_to :user
validate :user_cant_be_blacklisted, on: :confirmation
validate :user_cant_double_book, on: :confirmation
validate :grouper_cant_be_full, on: :confirmation
validate :grouper_cant_have_occurred, on: :confirmation
@carolineartz
carolineartz / server.sh
Created February 3, 2016 16:37 — forked from MohamedAlaa/server.sh
osx computer info in terminal
#!/bin/bash
echo "--------------------------------------------------------------------------------"
uname -a
echo "--------------------------------------------------------------------------------"
MEMORY=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Memory' | awk '{print $1 $2 $3}'`
echo "$MEMORY"
echo "--------------------------------------------------------------------------------"
CORES_COUNT=`sysctl hw.ncpu | awk '{print $2}'`
echo "CPU"
sysctl -n machdep.cpu.brand_string
@carolineartz
carolineartz / grocery_list.rb
Last active October 7, 2015 04:11 — forked from celeen/grocery_list.rb
for DBC Phase 0 coaching
# Requirements
#
# Create a new list
# Add an item with a quantity to the list
# Remove an item from the list
# Update quantities for items in your list
# Print the list (Consider how to make it look nice!)
# Pseudocode
@carolineartz
carolineartz / rspec_model_testing_template.rb
Last active August 29, 2015 14:27 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@carolineartz
carolineartz / _.md
Last active August 29, 2015 14:20 — forked from ejfox/_.md
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1

or

WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.9.0
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'