🏳️🌈
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
# Bit.ly API implementation - thanks to Richard Johansso http://gist.github.com/112191 | |
require 'httparty' | |
class Api::Bitly | |
include HTTParty | |
base_uri 'api.bit.ly' | |
format :json | |
# Usage: Bitly.shorten("http://example.com") | |
def self.shorten(url) |
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
<html> | |
<head> | |
<title>Event creation form</title> | |
</head> | |
<!-- All strings - These are mandatory fields title, start_date, end_date, timezone. The description is optional but guess we would require --> | |
<body> | |
<!-- A form to create an event and passes it's variables to event_creator.php --> | |
<form method="post" action="event_creator.php"> | |
<fieldset> |
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
<%= placeholder_image(728, 90, name: 'IAB Leaderboard ad', background_color: 'ccc') %> |
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
# Add this to your application.rb | |
config.middleware.use Rack::Cors do | |
allow do | |
origins '*' | |
# location of your API | |
resource '/api/*', :headers => :any, :methods => [:get, :post, :options, :put] | |
end | |
end |
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
# This goes in config/locales/en.rb (*not* en.yml) | |
{ | |
:en => { | |
:time => { | |
:formats => { | |
:full => lambda { |time, _| "%H:%M | %A, #{time.day.ordinalize} %B %Y" } | |
} | |
} | |
} | |
} |
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
# Initialize Mechanize Agent | |
agent = Mechanize.new | |
# Visit a web page | |
agent.get 'http://localhost:3000/' | |
# get the url of the current page | |
agent.page.uri #=> http://localhost:3000 | |
# agent remembers the scheme + host, so no need to supply it when navigating somewhere else |
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
// wanted a version where i could just use reduce but without building a Frame object ... | |
// expands rolls to include bonus values, e.g. | |
func testExpandRolls() { | |
let game = BowlingGame() | |
game.roll(5,4, 10, 5,5, 6,5) | |
var expanded = game.expandRolls() | |
XCTAssertEqualObjects(expanded, [5,4, 10,5,5, 5,5,6, 6,5], "expanded") | |
} |
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
// Swift playground experimenting with payroll. | |
// (I have my reasons.) | |
println("Hello") | |
import Foundation | |
// This stuff sets rounding to two places after decimal | |
var mode = NSRoundingMode.RoundPlain |