Skip to content

Instantly share code, notes, and snippets.

@lilliealbert
lilliealbert / gist:3094250
Created July 11, 2012 22:44
folks.methods
[:inspect, :to_s, :to_a, :to_ary, :frozen?, :==, :eql?, :hash, :[], :[]=, :at, :fetch, :first, :last, :concat, :<<, :push, :pop, :shift, :unshift, :insert, :each, :each_index, :reverse_each, :length, :size, :empty?, :find_index, :index, :rindex, :join, :reverse, :reverse!, :rotate, :rotate!, :sort, :sort!, :sort_by!, :collect, :collect!, :map, :map!, :select, :select!, :keep_if, :values_at, :delete, :delete_at, :delete_if, :reject, :reject!, :zip, :transpose, :replace, :clear, :fill, :include?, :<=>, :slice, :slice!, :assoc, :rassoc, :+, :*, :-, :&, :|, :uniq, :uniq!, :compact, :compact!, :flatten, :flatten!, :count, :shuffle!, :shuffle, :sample, :cycle, :permutation, :combination, :repeated_permutation, :repeated_combination, :product, :take, :take_while, :drop, :drop_while, :pack, :dclone, :entries, :sort_by, :grep, :find, :detect, :find_all, :flat_map, :collect_concat, :inject, :reduce, :partition, :group_by, :all?, :any?, :one?, :none?, :min, :max, :minmax, :min_by, :max_by, :minmax_by, :member?, :each_wi
public function getSubscriberList(){
$result = array();
$startIndex = 0;
$limit = 500;
$numberOfCurrentBatchRecord = $limit;
$numberOfBatchRan = 0;
$safeGardCount = 10;
while($limit == $numberOfCurrentBatchRecord && $numberOfBatchRan < $safeGardCount){
$startIndex = $limit * $numberOfBatchRan;
@lilliealbert
lilliealbert / cats
Created November 13, 2012 22:20
how about this indentation
vr.addListMember({
'session_id' => sid,
'list_member' => {
'list_id' => lid,
'member_data' => [
{
'name' => 'email_address',
'value' => '[email protected]'
},
{
@lilliealbert
lilliealbert / RailsBridge_class_levels
Last active December 14, 2015 12:38
RailsBridge - Rails curriculum class levels
Blue
* Totally New to Programming
* You have little to no experience with the terminal or a graphical IDE
* You might have done a little bit with HTML or CSS, but not necessarily
* You're unfamiliar with terms like methods, arrays, lists, hashes, or dictionaries.
Green
* Somewhat New to Programming
* You may have used the terminal a little — perhaps to change directories, for instance
* You might has done an online programming tutorial or two
Bridgetroll::Application.routes.draw do
root :to => "events#index"
devise_for :users
resources :users do
resource :profile, :only => [:edit, :update, :show]
end
resources :meetup_users, :only => [:index, :show]
@lilliealbert
lilliealbert / mode
Created March 28, 2013 23:24
trying to get to a mode
def mode(array)
frequency_hash = {}
array.each do |index|
frequency_hash[index] = array.count(index)
end
# now we have a hash of { number: frequency }
puts "here's the frequency of each thing, key = number, value = frequency of that number"
puts frequency_hash
@lilliealbert
lilliealbert / rpn calculator of doom
Last active December 16, 2015 00:29
computers are hard
class RPNCalculator
def evaluate(exp)
exp_array = exp.split(" ").to_a
rpn_array = []
exp_array.each do |i|
if i.match(/\d/) != nil
rpn_array << i.to_i
else
rpn_array << i
end
def factorial(n)
if n == 0
return 1
end
total = n
(n-1).times do
total = total * (n - 1)
n -= 1
end
total
@lilliealbert
lilliealbert / sendEmailCampaignTest.php
Created April 18, 2013 20:57
Sending a campaign test to multiple recipients
<?php
$vr->sendEmailCampaignTest(
array(
'session_id' => $sid,
'campaign_id' => $cid,
'recipients' => array(
array(
array(
'name' => "email_address",
'value' => '[email protected]',
Git Cheat Sheet
first time:
git config --global user.name "My Name"
git config --global user.email "[email protected]"
each repo:
git init
LOCAL THINGS