Skip to content

Instantly share code, notes, and snippets.

View stevekinney's full-sized avatar

Steve Kinney stevekinney

View GitHub Profile
@stevekinney
stevekinney / kinney-quix.txt
Created April 23, 2010 18:58
Quix Commands
> Steve Kinney's Custom Quix Commands
> TITLE: kinney-quix.txt
> REMARKS: Based on Merlin Mann's and Roberto Mateu's Custom Quix Commands
> GITHUB: http://gist.github.com/376996
> MORE: http://quixapp.com
> UPDATED: 2010-04-23_14-57-14
@Custom Quix Commands
@May organize these better once they all stabilize
bit javascript:var%20e=document.createElement('script');e.setAttribute('language','javascript');e.setAttribute('src','http://bit.ly/bookmarklet/load.js');document.body.appendChild(e);void(0); Make a bit.ly link
@stevekinney
stevekinney / fizzbuzz.rb
Created November 24, 2011 00:49
FizzBuzz in Ruby
1.upto(100) do |x|
if x % 3 == 0 && x % 5 == 0
puts "FizzBuzz"
elsif x % 3 == 0
puts "Fizz"
elsif x % 5 == 0
puts "Buzz"
else
puts x
end
@stevekinney
stevekinney / fizzbuzz.js
Created January 10, 2012 03:09
FizzBuzz in JavaScript
for (var i = 0; i <= 100; i++){
if (i % 3 === 0 && i % 5 === 0) {
document.write("FizzBuzz")
} else if (i % 3 === 0) {
document.write("Fizz")
} else if (i % 5 === 0) {
document.write("Buzz")
} else {
document.write(i)
}
@stevekinney
stevekinney / fahrenheit_to_celsius.js
Created July 25, 2012 13:02
Function Example: Convert Fahrenheit to Celsius
function convertFahrenheitToCelsius(temperature) {
// Take whatever temperature the function is handed, do some math and return it.
return (temperature - 32) * (5/9)
}
// Prompt the user and store whatever they say in a variable.
var theirInput = prompt("Enter in a Fahrenheit temperature & I'll convert it to Celsius");
// Run their number through the function and store it in a variable named result.
var result = convertFahrenheitToCelsius(theirInput);
@stevekinney
stevekinney / .vimrc
Last active October 11, 2015 10:58
Vim Configuration, 2012-10-09
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" My Bundles
Bundle 'stevekinney/snipmate.vim'

Week One: Day Two

Notes to Middle School Class

  • You can submit your work from yesterday and today here.

Notes to High School Class

An Introduction to CSS


Your Mission

Let's try something slightly different this week. Instead of hiding the assignment details down at the bottom, I am going to put them up here.

  • [Download the website template that I made for you][repo].
  • Change the `` tag from red to some other color.

Stupid JavaScript Tricks

Alerting

In the JavaScript console, type the following and hit enter.

alert("Hello world!");

Prompting

@stevekinney
stevekinney / grok-node.md
Created October 30, 2013 19:50
A list of Node resources for @jsoma.

[NPM][npm] is one of the best features of the Node.js ecosystem. It's like someone went in an fixed everything that annoyed me about RubyGems.

Nodejitsu published some awesome cheat sheets for NPM and package.json that I refer to often.

It's probably worth skimming through Max Ogden's [Art of Node][art]. There is also a series of interactive tutorials—kind of like "Try Ruby" that you can download and install at [Nodeschool.io][nodeschool].

Since you're coming from a Ruby background, you might want to check out [Express][], [Jade][], and [Stylus][]. I'm primarily recommending these three libraries because they are inspired by Sinatra, HAML, and SASS respectively. Playing around with Express is a good way to leverage your familiarity with Sinatra as you get the hang of some of the different patterns in Node.

var express = require('express'),
var passport = require('passport');
var TwitterStrategy = require('passport-twitter').Strategy;
var ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn;
var app = express();
// Set these variables in your environment.
var SESSION_SECRET = process.env.SESSION_SECRET;
var TWITTER_CONSUMER_KEY = process.env.TWITTER_CONSUMER_KEY;
var TWITTER_CONSUMER_SECRET = process.env.TWITTER_CONSUMER_SECRET;