Skip to content

Instantly share code, notes, and snippets.

View dommmel's full-sized avatar
💭
That worked!

Dominik dommmel

💭
That worked!
View GitHub Profile
@dommmel
dommmel / facebook_batch_api.rb
Created June 27, 2012 16:24
Takes an array of facebook graph object ids and assembles them into one batch request
def fb_batch_request(id_array, access_token)
raise "Array to long (>20)" if id_array.length > 20
queries = id_array.map { |id| {:method => 'GET', :relative_url => "#{id}"} }
route = "https://graph.facebook.com/?access_token=#{access_token}&batch=#{URI.encode(queries.to_json)}"
HTTParty.post(route)
end
@dommmel
dommmel / FacebookCategories_de.txt
Created April 5, 2012 09:03
List of Facebook Categories (obtained via https://gist.github.com/2173940)
Album
Amateurmannschaft
Anwendungsseite
Arzneimittel
Attraktionen/Unternehmungen
Ausbildung
Ausflüge/Sehenswürdigkeiten
Automobil
Autor
Autos
@dommmel
dommmel / import_into_couchdb.sh
Created December 16, 2011 10:07
import json files into mongo/couch
#!/bin/bash
COUCH_DB="http://127.0.0.1:5984/what_ever"
JSON_FOLDER="./jsonFiles/*"
TMP_FILE="/tmp/_couchdb_import.json"
for file in $JSON_FOLDER
do
echo '{"docs":' > $TMP_FILE
cat $file >> $TMP_FILE
@dommmel
dommmel / static_server.js
Last active August 1, 2018 13:29 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
#!/usr/bin/env node
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = process.argv[2] || 8888;
http.createServer(function(request, response) {