Skip to content

Instantly share code, notes, and snippets.

View animsamp.xml
<?xml version="1.1"?>
<!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 3.0 Language//EN"
"http://www.w3.org/2008/SMIL30/SMIL30Language.dtd">
<smil xmlns="http://www.w3.org/ns/SMIL" version="3.0" baseProfile="Language">
<head>
<layout>
<root-layout width="150" height="200"/>
<region xml:id="b" left="0" width="150" top="0" height="150" backgroundColor="purple"/>
<region xml:id="t" left="0" width="150" top="150" height="50"/>
</layout>`
View gist:4074973
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js";
document.getElementsByTagName('head')[0].appendChild(jq);
function closepp () {
if (jQuery("a.SelLnkGreen").length > 0) {
alert("gotta live one");
}
View adapting classes for angular
# in order to do this:
# <div ng:controller="MyController">{{message}}</div>
# I used to be able to
class MyController
constructor:->
@message = "Hello World"
# Now I need:
@ludicast
ludicast / Tunes.coffee
Created Nov 28, 2011
updated peepcode-tunes example
View Tunes.coffee
class @TunesCtrl
constructor:($xhr, @player)->
$xhr 'GET', 'albums.json', (statusCode, body)=>
@albums = body
TunesCtrl.$inject = ['$xhr', 'player']
class Player
constructor:(@$audio)->
@ludicast
ludicast / Tunes.coffee
Created Nov 28, 2011
Coffeescript conversion of peepcode-tunes for angularjs
View Tunes.coffee
class @TunesCtrl
constructor:($xhr)->
@player = @$parent.$new Player
$xhr 'GET', 'albums.json', (statusCode, body)=>
@albums = body
TunesCtrl.$inject = ['$xhr']
class @Player
constructor:(@$audio)->
@ludicast
ludicast / backbone_tunes.coffee
Created Nov 5, 2011
translation into coffeescript of code for backbone.js peepcode
View backbone_tunes.coffee
window.Album = Backbone.Model.extend
isFirstTrack: (index)->
index == 0
isLastTrack: (index)->
index >= @get('tracks').length - 1
trackUrlAtIndex: (index)->
if @get('tracks').length > index
@get('tracks')[index].url
else
null
View gist:557078
def creating_a_user
@user = Factory.build @user
fill_in "user[email]", :with => @user.email
click_button "Create"
end
on_following_link_to new_user_path do
where :creating_a_user do
specify { page.should have_content(@user.email) }
end
View sake_blocks1.rb
with_existing :user do
on_visiting edit_user_path do
it {should let_me_edit_the_user}
end
end
View rspec_sample.rb
context "when a user exists" do
before { @user = Factory :user }
context "when I visit the page for editing that user" do
before { visit "/users/#{@user.id}/edit" }
it {should let_me_edit_the_user}
end
end
View gist:555095
Scenario: Search by topic
Given a topic exists
And some courses exist covering that topic
And other courses exist that do not cover the topic
When I search for that topic
Then I should see the courses that cover the topic
And I should not see the courses that do not cover the topic