- Various jQuery tutorials ported to CS
- CoffeeScript basics
- Cool colours, not the least of features :)
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
reverse = (s) -> | |
if s.length < 2 then s else reverse(s[1..-1]) + s[0] | |
s = "Hello" | |
console.log "s=#{s}, s.reverse=#{reverse(s)}" |
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
OAuth = require('oauth').OAuth | |
_ = require 'underscore' | |
class LinkedInClient | |
@baseUrl: 'https://api.linkedin.com' | |
@requestTokenUrl: "#{@baseUrl}/uas/oauth/requestToken" | |
@accessTokenUrl: "#{@baseUrl}/uas/oauth/accessToken" | |
@authorizeUrl: "#{@baseUrl}/uas/oauth/authorize" | |
@profileFields: ['id', 'headline', 'first-name', 'last-name', 'public-profile-url', 'picture-url', 'educations', 'positions', 'email-address'] |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title> | |
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
$(function () { | |
var extractToken = function(hash) { |
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
$j = jQuery | |
$j('#ani2_btn1').click -> | |
$j('#ani2_worm_bar') | |
.animate(width:78).animate(left:'+=40',width:38) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>jQuery + CoffeeScript tutorial: animation stacking</title> | |
<style> | |
div.tree-frog {font-size: 12pt; border: 1px solid white; height: 38px; width: 38px; position: absolute} | |
</style> | |
<script src="coffee-script.js"></script> | |
<script src="jquery-1.7.1.js"></script> | |
</head> |
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
<div id="palette" style="width: 510px; height: 80px;"> | |
</div> | |
<script type="text/coffeescript"> | |
colors = ['#CCDDBB', '#99CC66', '#88AA66', '#AADDCC', '#66AAAA', '#559999', '#FFFFDD', '#FF9922', '#DD8822', '#AACCDD', '#5599CC', '#4477AA'] | |
next_square_html = (color) -> | |
""" | |
<div style="background: #{color}; | |
border: 1px solid grey; | |
height: 30px; |
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
#Using $j instead of just $ to be more specific | |
$j = jQuery | |
#Storing page elements to local variables | |
clickme = $j '#ani1_clickme' | |
restore = $j '#ani1_restore' | |
bar1 = $j '#ani1_bar1' | |
bar2 = $j '#ani1_bar2' | |
#Cool shortcut, instead of $j(document).ready(function(){ |
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
major, minor = `bison --version`.scan(/bison \(GNU Bison\) (\d+)\.(\d+)/)[0].map(&:to_i) | |
$?.exitstatus == 0 && ([major, minor] <=> [2,4]) >=0 |
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
-module(ring_benchmark). | |
-export([new/2]). | |
new(N, M) -> | |
spawn(fun() -> spawn_ring(N, M) end). | |
spawn_ring(N, M) -> | |
io:format("First process: ~p~n", [self()]), | |
NextPid = spawn_rest(self(), N), |