Skip to content

Instantly share code, notes, and snippets.

def cracklepop(i)
if i % 15 == 0
"CracklePop"
elsif i % 5 == 0
"Pop"
elsif i % 3 == 0
"Crackle"
else
i
end
module TicTacToe
class Application
def run
display_launch_options
end
def display_launch_options
puts "n: New Game"
puts "q: Quit"
selection = gets
@worace
worace / gist:4b1d430db1c7be257023
Created September 15, 2014 04:15
ios error log
2014-09-15 00:13:11.917 troutr-ios[37485:60b] Cannot find executable for CFBundle 0xb76f4e0 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/GeoServices.axbundle> (not loaded)
2014-09-15 00:13:11.922 troutr-ios[37485:60b] Cannot find executable for CFBundle 0xb64f090 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/StoreKitFramework.axbundle> (not loaded)
2014-09-15 00:13:11.925 troutr-ios[37485:60b] Cannot find executable for CFBundle 0xb65a190 </Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/AccessibilityBundles/CertUIFramework.axbundle> (not loaded)
2014-09-15 00:13:11.992 troutr-ios[37485:60b] authentication loadview
2014-09-15 00:13:11.992 troutr-ios[37485:60b] auth view init
2014-09-15 00:13:11.993 troutr-ios[37485:60
@worace
worace / exercise-loops-and-functions.go
Last active August 29, 2015 14:13
Golang Tour Exercises
package main
import (
"fmt"
"math"
)
func guessOutsideDelta(guess, x float64) bool {
delta := .00000000001
return (math.Abs(guess * guess - x) > delta)
@worace
worace / miner.go
Created January 22, 2015 02:42
crude golang gitcoin miner for https://github.com/worace/git-coin
package main
import (
"bytes"
"crypto/sha1"
"encoding/hex"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
@worace
worace / gist:7867faa4a3f2d3ba33b1
Created January 24, 2015 19:35
sudoku huzzah
attempting to solve puzzle sample_puzzles/puzzle_38.txt
solved puzzle sample_puzzles/puzzle_38.txt in 0.078505 seconds
attempting to solve puzzle sample_puzzles/puzzle_44.txt
solved puzzle sample_puzzles/puzzle_44.txt in 21.837613 seconds
attempting to solve puzzle sample_puzzles/puzzle_43.txt
solved puzzle sample_puzzles/puzzle_43.txt in 2.452277 seconds
attempting to solve puzzle sample_puzzles/puzzle_3.txt
solved puzzle sample_puzzles/puzzle_3.txt in 0.376745 seconds
attempting to solve puzzle sample_puzzles/puzzle_33.txt
solved puzzle sample_puzzles/puzzle_33.txt in 0.341731 seconds

#Who uses Turing Slack? Turing has a fairly large community of people who use Slack: mentors, teachers, guests, students, and past students. Members should be mindful of other people's involvement in the Turing Slack community. Many mentors and guests are in different time zones, and most students need their sleep when they can get it (see: night owls or early birds). Please be aware of your local time and other users' local time when you are sending a message that will notify other members of the message. Most users have phone and/or email notifications (@channel (see below) and direct message) turned on.

#When Should I @Channel? Almost never. Especially in the community channel. Here are things to ask yourself before you send out a message using @channel:

  • Is this message important to everyone in this channel?
  • Does this message directly impact everyone in this channel?
  • Will this message wa
@worace
worace / benchmark.rb
Created February 9, 2015 22:52
Benchmark Examples in Ruby
require "benchmark"
# Benchmark perf of array.find
array = (1..1_000_000).to_a
res = Benchmark.measure do
array.find { |i| i == (array.length - 3) }
end
@worace
worace / code_review.md
Last active August 29, 2015 14:15
Turing Code Review Guidelines

Purpose of Code Review

Remember that the purpose of code review is to learn from the feedback of your peers and give constructive feedback to help one another improve. Even when it's not your code being reviewed, you can often pick up a lot of ideas from the discussion. When it is your code being reviewed, keep in mind that software is neither done nor perfect -- there's always something we can do better.

Code Review Process

  1. Clone the project -- project owner should make sure beforehand the project is pushed to github
  2. Setup dependencies (bundle, create DBs, etc.) -- A good project README will have clear instructions for what steps are necessary.
  3. Use the project (5 minutes) -- If it's a CLI try working through the commands a few times. If it's a web app, click around and try to follow a few different "user paths" through the app. Run the project. The project owner will probably need to serve as a guide here, but the goal is to quickly get a broad understanding of what the ap
@worace
worace / grandma.rb
Created February 12, 2015 19:03
Deaf Grandma Class-based refactoring
class Grandma
# returns true if the string
# is all caps
# otherwise returns false
def shouted?(string)
string == string.upcase
end
# returns true if you say "GOODBYE"
# otherwise returns false