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 / 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) {
@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 / 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 / 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 / link_tracking.coffee
Created August 17, 2012 12:02
Track clicks with Google Analytics and Mixpanel
@dommmel
dommmel / gist:3623754
Created September 4, 2012 17:21
Twitter Bootstrap Shopify Navbar
<!-- Navbar
================================================== -->
<div class="navbar navbar-inverse navbar-fixed-top" id="bs_top-menu">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@dommmel
dommmel / localize_greeting.coffee
Created September 18, 2012 13:43
Localize your greeting message with javascript
##################################################################
# #
# Copyright (C) 2012 Dommmel <dommmel@gmail.com> #
# This code is released under WTFPL, version 2.0. #
# #
##################################################################
# Usage:
# <span id="sayhi">привет</span>
# <script>
@dommmel
dommmel / create_gallery.rb
Created October 21, 2012 15:18
Turns a folder of images into an html gallery (optimized for mobile safari). Useful for previewing designs of mobile websites. Just put the generated gallery into dropbox and mail the link to the index.html file to the client.
@dommmel
dommmel / capture_screenshot.js
Created January 8, 2013 10:00
Script to take full page screenshots using phantomJs via CasperJs. Run via ```casperjs capture_screenshot.js```
var casper = require('casper').create({
viewportSize: {width: 950, height: 950}
});
casper.start('http://www.google.com/', function() {
this.captureSelector('/tmp/pp.png', 'body');
});
casper.run();
require 'rufus/scheduler'
scheduler = Rufus::Scheduler.start_new
if Rails.env.production?
scheduler.every '10m' do
require "net/http"
require "uri"
Net::HTTP.get_response(URI.parse(ENV["HOSTNAME"]))
end
end