Skip to content

Instantly share code, notes, and snippets.

@allthetime
allthetime / README.md
Last active August 29, 2015 14:06 — forked from kvirani/README.md

Write a method count_letters that can tell us all the unique characters that exist in a string that is passed into the method. Furthermore, the method should also report back how many instances of each letter were found in the string.

Methods generally return one object. That object can be a number, a boolean, nothing (nil), a symbol, a string, and so on. However, we need to return an object that can represent all the characters found in the input string, and their respective counts.

What type of object should be returned back by count_letters? A Hash comes to mind!

So count_letters("lighthouse in the house...") would return:

{

'l' => 1,

#READ CSV AND DUMP TO ARRAY
contacts_db = []
CSV.foreach('contact_list.csv') do |row|
contacts_db << row
end
contacts_db
#OPEN CSV FOR WRITING
c = CSV.open('contact_list.csv', 'wb')
@allthetime
allthetime / gist:02423aa3ffb075f36497
Created September 12, 2014 21:28
Old Timey First Names From Around The Universe All Capitalized
names = ["N", "Wy", "Lon", "Thi", "Gau", "Kai", "Min", "Nel", "Lon", "Gib", "Ham", "Wat", "Ode", "Urs", "Dru", "Ede", "Yve", "Ham", "Uno", "Yon", "Alo", "Rob", "Mor", "Est", "Jop", "Ahu", "Gai", "Odo", "Fam", "Lel", "Enno", "Adso", "Higg", "Anko", "Tiro", "Fato", "Beat", "Ayol", "Aldo", "Mahu", "Behe", "Harm", "Ulpt", "Apal", "Sede", "Behe", "Mana", "Kepa", "Gris", "Drue", "Anko", "Dirk", "Fery", "Onke", "Ucke", "Hone", "Iaki", "Unax", "Iker", "Acur", "Anno", "Dick", "Maso", "Gile", "Inko", "Josu", "Mago", "Jurg", "Julf", "Jean", "Joss", "Houd", "Oddo", "Wene", "Kahu", "Geve", "Esme", "Tane", "Lyon", "Saxo", "Ipar", "Acur", "Fray", "Eryx", "Himi", "Ralf", "Pate", "Owun", "Lion", "Hugo", "Otis", "Bizi", "Luli", "Abas", "Nott", "Argi", "Egun", "Ager", "Edun", "Ekhi", "Wala", "Keos", "Faro", "Hary", "Urre", "Ager", "Saba", "Joren", "Paios", "Rique", "Dicky", "Hamen", "Medon", "Alane", "Paris", "Midas", "Seber", "Hamen", "Macar", "Argos", "Bulis", "Bendy", "Galot", "Ernis", "Vital", "Habbe", "Oscar", "Sikke", "Ge
This file has been truncated, but you can view the full file.
Script started on Sat Sep 13 16:06:05 2014
_current_epoch:1: command not found: date
_current_epoch:1: bad math expression: operand expected at `/ 60 / 60 ...'
_current_epoch:1: command not found: date
_current_epoch:1: bad math expression: operand expected at `/ 60 / 60 ...'
%
]2;allthetime@CHRONIC: ~]1;~]2;allthetime@CHRONIC: ~]1;~
allthetime@CHRONIC [04:06:06] [~]
-> % [?1h=zzsh -xv[?1l>
require 'rspec'
require 'date'
require_relative '../config'
describe Teacher, "can create a teacher" do
before :each do
Teacher.destroy(Teacher.find_by(email:'g@g.com').id) unless Teacher.find_by(email:'g@g.com') == nil
@teacher = Teacher.create!(first_name:'Cow',last_name:'Jensen',gender:'ambigious',birthday:"11-30-88",email:'g@g.com',phone:'666-666-6666')
end
@allthetime
allthetime / gist:5095087443c86e916543
Created September 19, 2014 17:48
#thehuntforWHITE
%252525252525252525252525ffffff
@allthetime
allthetime / gist:c7f2dae5a4ba39a2b805
Created September 24, 2014 18:08
Venue data parsehub
{
"venue": [{
"name": "VIVO Media Arts Centre",
"address": "2625 Kaslo Street Vancouver BC\nV5M 3G8"
}, {
"name": "PAL Studio Theatre",
"address": "#8th floor-581 Cardero Street Vancouver BC\nV6G3L3"
}, {
"name": "Guilt & Co.",
"address": "1 Alexander Street Vancouver BC"
class Store < ActiveRecord::Base
has_many :employees
validates :name,
presence: true,
length: {maximum: 25}
integer_and_not_negative = {
numericality: {
only_integer: true,
greater_than_or_equal_to: 0
@allthetime
allthetime / gist:292427cc0d9799cc9cf7
Created September 27, 2014 04:49
RATY STARTER KIT
<form action="/" method="post">
<!-- the stars are here in an empty div -->
<div id="rate" name="raty"></div><br>
<!-- this is the hidden input that raty sends the data to -->
<input type="number" name="rating" style="display:none;" id="rating">
<input type="submit">
</form>
<!-- do this for static ratings -->
<div class="rating" data-score="<%= review.rating %>"></div>
(function(b) {
var a = {
init: function(c) {
return this.each(function() {
var d = this,
h = b(d).empty();
d.opt = b.extend(true, {}, b.fn.raty.defaults, c);
h.data("settings", d.opt);
d.opt.number = a.between(d.opt.number, 0, 20);
if (d.opt.path.substring(d.opt.path.length - 1, d.opt.path.length) != "/") {