This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
def initialize | |
@messages = {} | |
end | |
private |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATAURIPREFIX="data:image/png;base64," | |
TINYPNG_API_KEY=[register for one in https://tinypng.com] | |
api_loc=`curl -i --user api:$TINYPNG_API_KEY --data-binary @$1 https://api.tinypng.com/shrink | grep "Location:" | cut -f 2 -d " "` | |
echo -n $DATAURIPREFIX; curl -s $api_loc | base64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GildedRose = function () { | |
console.log("OMGHAI!"); | |
var items = []; | |
items.push(new Item("+5 Dexterity Vest", 10, 20)); | |
items.push(new Item("Aged Brie", 2, 0)); | |
items.push(new Item("Elixir of the Mongoose", 5, 7)); | |
items.push(new Item("Sulfuras, Hand of Ragnaros", 0, 80)); | |
items.push(new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20)); | |
items.push(new Item("Conjured Mana Cake", 3, 6)); | |
GildedRose.updateQuality(items); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bowling = { | |
getScore: function(scoreString){ | |
if (scoreString.length < 11) return -1; | |
if (scoreString.length > 21) return -1; | |
if (!scoreString.match(/^([1-9]|X|\/|-)*$/)) return -1; | |
var score = 0; | |
var scorePlus = 0; | |
var frame = 1; | |
var multi = 1; | |
for (i = 0; i<scoreString.length; i++){ |