Skip to content

Instantly share code, notes, and snippets.

@mrbongiolo
mrbongiolo / fql_query_page_photos.fql
Last active June 22, 2016 19:44
Query for FQL to get all photos from a Facebook Page albums and all photos tagged with that Facebook Page
# Formatted for readability
SELECT src, src_height, src_width, src_small, src_small_height, src_small_width
FROM photo
WHERE pid IN (SELECT pid
FROM photo_tag
WHERE subject='243117879034102' )
OR
pid IN (SELECT pid
FROM photo
WHERE aid IN (SELECT aid
@naholyr
naholyr / enableMultipleViewRoots.js
Created May 27, 2011 15:23
Allow multiple views roots in Express.js
// Usage:
// var express = require('express')
// require('enableMultipleViewRoots')(express)
module.exports = function(express) {
var old = express.view.lookup;
function lookup(view, options) {
// If root is an array of paths, let's try each path until we find the view
if (options.root instanceof Array) {
@bgreenlee
bgreenlee / crypto.rb
Created February 26, 2009 06:01
Simple Ruby wrapper for encryption/decryption using OpenSSL
class Crypto
# encrypts data with the given key. returns a binary data with the
# unhashed random iv in the first 16 bytes
def self.encrypt(data, key)
cipher = OpenSSL::Cipher::Cipher.new("aes-256-cbc")
cipher.encrypt
cipher.key = key = Digest::SHA256.digest(key)
random_iv = cipher.random_iv
cipher.iv = Digest::SHA256.digest(random_iv + key)[0..15]
encrypted = cipher.update(data)