Skip to content

Instantly share code, notes, and snippets.

@ColinTheRobot
ColinTheRobot / notes.md
Created January 23, 2016 19:41
friday notes after 245

We talked about scope and this, and defining functions as properties in an object.


Read the first parts of the following articles. If you read further just know it covers material and content that we're not talking about for a bit. Similary the articles talk a little bit about Jquery, you dont need to know jquery, we'll be covering that in a couple weeks.

https://www.smashingmagazine.com/2009/08/what-you-need-to-know-about-javascript-scope/

Read the sections you are here and how it works

@ColinTheRobot
ColinTheRobot / private.xml
Last active March 24, 2021 03:59 — forked from burtlo/private.xml
TMUX: Rebinding CAPS LOCK to CTRL + B
<?xml version="1.0"?>
<root>
<appdef>
<appname>Terminal</appname>
<equal>com.apple.Terminal</equal>
</appdef>
<item>
<name>TMUX Key Remappings</name>
<item>
<name>TMUX: Right Control to Ctrl+B</name>
@ColinTheRobot
ColinTheRobot / cleanrubyemail.rb
Last active August 29, 2015 14:27
clean ruby
# Hi! I'm Jim, the author of Clean Ruby and Ruby DSL Handbok and you're receiving this message because you either bought my
?book or signed up to join my mailing list.
# Hey there, Colin
# Following the rules for East-oriented Code helps me organize behavior in my code but it can lead to other benefits as well
# . As a result of following the rules, I find that my code is better prepared for restrictions like that which immutable objects introduce.
# I recently went looking for samples of how people are using instance_eval and instance_exec and ended up with a great example from FactoryGirl thanks to Joshua Clayton. As I was searching, I came upon some code which happened to use instance_eval. Although it was a simple use case for that method it lent itself as a much better example of commands, immutability, and East-oriented code.

NOTE: If you have RVM already set up you will need to decide whether you want to continue using RVM or if you'd prefer to switch to rbenv.

To uninstall follow these instructions: https://richonrails.com/articles/uninstalling-rvm

To check if you have RVM installed simply run the command $rvm. If it is not intalled you'll see the message command not found: rvm

RVM and RBENV do NOT work well together, so having both installed will cause weirdness


@ColinTheRobot
ColinTheRobot / dealer.rb
Last active August 29, 2015 14:22
Blackjack Game
class Dealer
attr_accessor :bank_roll, :deck, :dealt_cards, :score, :hidden_score
def initialize(bank_roll, deck)
@bank_roll = bank_roll
@deck = deck
@dealt_cards = []
@score = 0
@hidden_score = 0
end
@ColinTheRobot
ColinTheRobot / gist:d434c89546135dab3ac6
Last active October 3, 2016 12:48
How to ask for help

Formatting your GitHub Issue to ask for help:

PUSH OFTEN! Your code on GitHub should be up to date. Submitting an issue and linking us to old, out of date code is obviously going to hinder the process.

CONTEXT

WHAT YOU ARE TRYING TO SOLVE:

Write a detailed explanation of the feature or user story you're working on.

@ColinTheRobot
ColinTheRobot / gist:a53229a02881d4934b75
Created March 20, 2015 15:25
random code generator
def generate_code(number)
charset = Array('A'..'Z') + Array('a'..'z')
Array.new(number) { charset.sample }.join
end
puts generate_code(20)
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
source ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWCOLORHINTS=true
export PS1='\u:\W$(__git_ps1 " (%s)")\$ '
# DNSMasq
brew install dnsmasq
# follow onscreen instructions for dnsmasq config. path below may have changed
# cp /usr/local/Cellar/dnsmasq/2.63/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
# (MAY NOT BE NECESSARY)
# dnsmasq needs to run as root, so it needs to be installed into LaunchDaemons
# sudo cp /usr/local/Cellar/dnsmasq/2.63/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons/
# edit the conf. Replace "subl" with your editor call
@ColinTheRobot
ColinTheRobot / gist:3e54b6a0cba84fa22812
Created December 11, 2014 14:55
fuzzy-ish search algorithm on model.
# This algorithm is incomplete
# It is a fuzzy search for first_name, last_name, and user_name
def self.search(params)
params.downcase!
query = params.split
results = []