This file contains hidden or 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 GoogleAnalytics | |
@init: (webPropertyId) -> | |
@_initQueue(webPropertyId) | |
scriptTag = @_createScriptTag() | |
@_injectScriptTag(scriptTag) | |
@_initQueue: (webPropertyId) -> | |
window._gaq ?= [] | |
window._gaq.push ['_setAccount', webPropertyId] | |
window._gaq.push ['_trackPageview'] |
This file contains hidden or 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
/* | |
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js | |
*/ | |
var http = require('http'), | |
fs = require('fs'), | |
util = require('util'); | |
http.createServer(function (req, res) { | |
var path = 'video.mp4'; |
This file contains hidden or 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
// api/controllers/AuthController.js | |
var passport = require('passport'); | |
var AuthController = { | |
login: function (req,res) | |
{ | |
res.view(); | |
}, |
This file contains hidden or 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
RewriteEngine On | |
RewriteBase / | |
# ensure the browser supports gzip encoding | |
RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b | |
RewriteCond %{REQUEST_FILENAME}.gz -s | |
RewriteRule ^(.+) $1.gz [L] | |
# ensure correct Content-Type and add encoding header | |
<FilesMatch \.css\.gz$> |
This file contains hidden or 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
# MySQL. Versions 4.1 and 5.0 are recommended. | |
# | |
# Install the MySQL driver: | |
# gem install mysql2 | |
# | |
# And be sure to use new-style password hashing: | |
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
development: | |
adapter: mysql2 | |
encoding: utf8 |
This file contains hidden or 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
application :: MVar ServerState -> WS.Request -> WS.WebSockets WS.Hybi10 () | |
application state rq = do | |
WS.acceptRequest rq | |
WS.getVersion >>= liftIO . putStrLn . ("Client version: " ++) | |
sink <- WS.getSink | |
msg <- WS.receiveData | |
clients <- liftIO $ readMVar state | |
url <- liftIO fbUrl | |
let prefix = "Facebook code " |
This file contains hidden or 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
import System.Random | |
import System.Console.GetOpt | |
import System.Environment(getArgs, getProgName) | |
type Coord = (Int,Int) | |
type Range = (Int,Int) | |
type Area = (Coord,Coord) -- Upper-left and lower-right bounds. |
This file contains hidden or 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
import System.Random | |
import System.Console.GetOpt | |
import System.Environment(getArgs, getProgName) | |
type Coord = (Int,Int) | |
type Range = (Int,Int) | |
type Area = (Coord,Coord) -- Upper-left and lower-right bounds. |
This file contains hidden or 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
require 'redis' | |
# SADD key, member | |
# Adds the specified <i>member</i> to the set stored at <i>key</i>. | |
redis = Redis.new | |
redis.sadd 'my_set', 'foo' # => true | |
redis.sadd 'my_set', 'bar' # => true | |
redis.sadd 'my_set', 'bar' # => false | |
redis.smembers 'my_set' # => ["foo", "bar"] |
This file contains hidden or 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
{-# LANGUAGE BangPatterns #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RecordWildCards #-} | |
module Snap.Snaplet.Auth.Backends.MongoDB | |
( initMongoAuth | |
) where | |
------------------------------------------------------------------------------ | |
import Control.Arrow |