Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
Backbone = require 'backbone' | |
class Foo extends Backbone.Model | |
set: -> super | |
foo = new Foo | |
foo.set x: 'x' | |
console.log foo.get 'x' # x |
# Rewrote excellent intro to Backbone.js http://arturadib.com/hello-backbonejs/ in CoffeeScript | |
$ -> | |
Backbone.sync = (method, model, success, error) -> | |
success() | |
class Item extends Backbone.Model | |
defaults: | |
part1: 'hello' | |
part2: 'world' |
# Getting these Errors? | |
error: SSL certificate problem, verify that the CA cert is OK. Details: | |
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://<some site here> | |
# From this thread you need to install root certificates. Do the following: | |
cd /usr/ssl/certs | |
$ curl http://curl.haxx.se/ca/cacert.pem | awk 'split_after==1{n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1} {print > "cert" n ".pem"}' | |
$ c_rehash |
Use this Titanium Studio ini file in place of your existing. | |
On OSX right click on the TitaniumStudio.app and choose 'Show Package Contents", then navigate to "Contents/MacOS/TitaniumStudio.ini" and edit the file. | |
<ini> | |
-startup | |
../../../plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar | |
--launcher.XXMaxPermSize | |
256m |
Some exercises from the Falsy Values workshops.
The good parts:
### | |
Author: Jason Giedymin <jasong _a_t_ apache -dot- org> | |
http://www.jasongiedymin.com | |
https://github.com/JasonGiedymin | |
Appearing in the Quake III Arena source code[1], this strange algorithm uses | |
integer operations along with a 'magic number' to calculate floating point | |
approximation values of inverse square roots[5]. |
### | |
Author: Jason Giedymin <jasong _a_t_ apache -dot- org> | |
http://www.jasongiedymin.com | |
https://github.com/JasonGiedymin | |
This CoffeeScript Javascript Fast Fibonacci code is | |
based on the python code from Robin Houston's blog. | |
See below links. | |
A few things I want to introduce in time are implementions of |
# File is named as '.sh' for highlighting. Don't actually run this (hash bang removed). | |
# | |
# First of all, you should stop using cygwin and just use a VM or install linux. | |
# By continuing you acknowledge the fact your a nut. :-D | |
# | |
# If your having errors with Cygwin and NPM install packages such as: | |
# npm ERR! tar "-mvxpf" "-" "--no-same-owner" | |
# | |
# Do the following: |
... | |
<key>fileTypes</key> | |
<array> | |
<string>js</string> | |
<string>htc</string> | |
<string>jsx</string> | |
<string>coffee</string> | |
</array> | |
... |
def bits(n): | |
'''Represent an integer as an array of binary digits.''' | |
bits = [] | |
while n > 0: | |
n, bit = divmod(n, 2) | |
bits.append(bit) | |
bits.reverse() | |
return bits | |
def fib_fast(n): |