Skip to content

Instantly share code, notes, and snippets.

@jshawl
jshawl / cli
Created November 17, 2014 20:33
# CLI Exercises
1. Create a new directory in your home directory named flowers.
2. Create four directories in flowers/: petunia, violet, marigold, and seeds.
3. Create four files in violet/
- marigold-seeds.txt
- marigold-food.txt
- violet-seeds.txt
- petunia-bulbs.txt
4. Copy the marigold related files to the marigold directory

Ex-mode uses

Explore Files in current directory

:ex .

Explore Files in directory relevant to open file

:Ex

@jshawl
jshawl / gcd.rb
Last active August 29, 2015 14:10
def gcd *args
divisors = args.map do |arg|
(1..arg).select { |n| arg % n == 0} # find all divisors
end
divisors.inject(:&).max # find intersection of all arrays, grab max value
end
p gcd( 12, 24, 36 )
def count_to limit, index = 1, nums = []
if nums.empty?
nums = [1,2]
end
if index == limit
return (nums)
else
next_digit = nums[-2] + nums[-1]
if next_digit <= limit
nums << next_digit
require 'sinatra'
require 'sinatra/reloader'
get '/coin_toss' do
return ['Heads','Tails'].sample
end
get '/dice_roll' do
rand(1..6).to_s
end
@jshawl
jshawl / precess-input-1418991386.scss
Created December 19, 2014 12:16
a precess production
@mixin transitions($transition) {
-webkit-transition: $transition;
-moz-transition: $transition;
-o-transition: $transition;
transition: $transition;
}
body{
@include transitions(color .5s ease);
}
@jshawl
jshawl / precess-input-1424134548.scss
Last active August 29, 2015 14:15
a precess production
$color:blue;
a{
green(#3E123E, 5%);
}
@jshawl
jshawl / precess-output-1424174773.css
Last active August 29, 2015 14:15
a precess production
a {
color: #521852;
}

Homework, W01D01


Create a function in your .bash_profile that will set up a working directory for a new GA student!

Things it should do:

  • Create a folder called GeneralAssembly
We couldn’t find that file to show.