Skip to content

Instantly share code, notes, and snippets.

new-host-4:~ davidransohoff$ pwd
/Users/davidransohoff
new-host-4:~ davidransohoff$ mkdir ~/project
new-host-4:~ davidransohoff$ pwd
/Users/davidransohoff
new-host-4:~ davidransohoff$ cd ~/project
new-host-4:project davidransohoff$ pwd
/Users/davidransohoff/project
new-host-4:project davidransohoff$ mkdir git-demo
new-host-4:project davidransohoff$ pwd
new-host-4:git-demo davidransohoff$ git init
Initialized empty Git repository in /Users/davidransohoff/project/git-demo/.git/
new-host-4:git-demo davidransohoff$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
new-host-4:git-demo davidransohoff$ touch README.md
new-host-4:git-demo davidransohoff$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# README.md
new-host-4:git-demo davidransohoff$ git add README.md
new-host-4:git-demo davidransohoff$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: README.md
new-host-4:git-demo davidransohoff$ git commit -m "add README"
[master (root-commit) b886b3e] add README
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
new-host-4:git-demo davidransohoff$ git remote add origin git@github.com:sranso/git-demo.git
@sranso
sranso / push
Created October 21, 2013 18:30
new-host-4:git-demo davidransohoff$ git push -u origin masterCounting objects: 3, done.
Writing objects: 100% (3/3), 217 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:sranso/git-demo.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
new-host-4:git-demo davidransohoff$ git push
Everything up-to-date
@sranso
sranso / fizzbuzz.js
Created November 15, 2013 04:50
fizzbuzz.js
// prints numbers 1-100
// when the number is divisible by 3, say fizz
// when the number is divisible by 5 say buzz
// when the number is divisible by 3 and 5 say fizzbuzz
for (var i = 1; i <= 100; i++)
{
if (i % 3 == 0 && i % 5 == 0) {console.log("fizzbuzz")}
else if (i % 3 == 0) {console.log("fizz")}
else if (i % 5 == 0) {console.log("buzz")}
@sranso
sranso / fizzbuzz.rb
Created November 15, 2013 04:51
fizzbuzz.rb
# prints numbers 1-100
# when the number is divisible by 3, say fizz
# when the number is divisible by 5 say buzz
# when the number is divisible by 3 and 5 say fizzbuzz
101.times do |i|
next if i == 0
if i % 3 == 0 && i % 5 == 0
puts "fizzbuzz"
elsif i % 3 == 0
@sranso
sranso / fizzbuzz-notmine.rb
Created November 15, 2013 05:21
not my fizzbuzz
#http://rosettacode.org/wiki/FizzBuzz#Ruby
1.upto(100) do |n|
print "Fizz" if a = (n % 3).zero?
print "Buzz" if b = (n % 5).zero?
print n unless (a || b)
print "\n"
end