Skip to content

Instantly share code, notes, and snippets.

irb(main):002:0> "pizza pie".split
=> ["pizza", "pie"]
irb(main):003:0> "pizza pie".split.class
=> Array
irb(main):004:0> Array.new
=> []
irb(main):005:0> []
=> []
irb(main):006:0> data = []
=> []
age = 5
wishes = (age * "happy " + "Birthday!").capitalize
puts wishes
puts "HI GUYS"
puts "10 times 10 is #{10 * 10}"
diff --git a/Gemfile b/Gemfile
index da92010..2218160 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,3 +5,4 @@ gem 'reek'
gem 'rake'
gem 'rspec', '~> 3.1.0'
gem 'pry'
+gem "ruby-prof"
diff --git a/Gemfile.lock b/Gemfile.lock
@worace
worace / pem.clj
Created March 1, 2016 23:34
ALL MANNER OF CLJ RSA KEY SERIALIZATION
(ns block-chain.pem
(:require [clojure.java.io :as io]
[clojure.string :refer [join split]]
[block-chain.encoding :refer :all]))
(defn keydata [reader]
(->> reader
(org.bouncycastle.openssl.PEMParser.)
(.readObject)))

Pulling Updated Changes from the Project Template

  1. Go to your project directory
  2. Checkout the master branch (git checkout master)
  3. Pull from the template master branch (git pull https://github.com/turingschool-examples/hyde.git master)
  4. Resolve any CONFLICTs created by the merge. Remember to read the instructions from git carefully. It will tell you if you have any conflicts and in which files.
  5. If you get conflicts in the Gemfile.lock, it's easiest to resolve these by deleting the file (rm Gemfile.lock) and re-running bundler (bundle)
  6. After resolving CONFLICTs, stage the files using (git add) and commit them (git commit). You've now merged the updated changed from the original project template into your local repository.
  7. Push these new changes to your fork (git push origin master).
diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb
index 591a04a..7142c15 100644
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -1,10 +1,11 @@
class ArticlesController < ApplicationController
def show
- @article = Article.find(params[:id])
+ @article = Article.includes(:comments).find(params[:id])
end
@worace
worace / examples.rb
Created February 23, 2016 18:01
Refactoring Lesson Examples
class Engine
def core_weight
250
end
def propeller_weight
50
end
end
worace @ workshops ➸ mkdir babys_first_repo
worace @ workshops ➸ cd babys_first_repo
worace @ babys_first_repo ➸ la
worace @ babys_first_repo ➸ git status
fatal: Not a git repository (or any of the parent directories): .git
worace @ babys_first_repo ➸ git init
Initialized empty Git repository in /Users/worace/Turing/workshops/babys_first_repo/.git/
worace @ babys_first_repo ➸ vim pizza.txt
worace @ babys_first_repo ➸ git status
On branch master
@worace
worace / git_coin.rb
Last active February 19, 2016 22:59
require "digest"
require "hurley"
def mine(target, input)
nonce = 0
message = "#{input}#{nonce}"
while Digest::SHA1.hexdigest(message).hex > target.hex
nonce = nonce + 1
message = "#{input}#{nonce}"
end
@worace
worace / sab.markdown
Created February 19, 2016 20:24
Student Advisory Board 2/18

Student Advisory Board 2-18-16

General Themes

  • More satisfaction with posse challenge -- smaller challenges and more lighthearted review process make people more engaged and leave time for additional work / bonding
  • Still some concern over large posses -- large groups make it hard for everyone to participate
  • General discussion around tone and focus of protocol -- would like sessions