Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Kinney stevekinney

View GitHub Profile
View kinney-quix.txt
> 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
View fizzbuzz.rb
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 Jan 10, 2012
FizzBuzz in JavaScript
View fizzbuzz.js
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 Jul 25, 2012
Function Example: Convert Fahrenheit to Celsius
View fahrenheit_to_celsius.js
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 Oct 11, 2015
Vim Configuration, 2012-10-09
View .vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
" My Bundles
Bundle 'stevekinney/snipmate.vim'
View follow-up.md

Week One: Day Two

Notes to Middle School Class

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

Notes to High School Class

View introduction-to-css.md

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 <h1> tag from red to some other color.
View stupid-js-tricks.md

Stupid JavaScript Tricks

Alerting

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

alert("Hello world!");

Prompting

@stevekinney
stevekinney / grok-node.md
Created Oct 30, 2013
A list of Node resources for @jsoma.
View grok-node.md

[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.

View twitter-express.js
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;