View static_server.js
This file contains 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
#!/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) { |
View import_into_couchdb.sh
This file contains 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
#!/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 |
View FacebookCategories_de.txt
This file contains 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
Album | |
Amateurmannschaft | |
Anwendungsseite | |
Arzneimittel | |
Attraktionen/Unternehmungen | |
Ausbildung | |
Ausflüge/Sehenswürdigkeiten | |
Automobil | |
Autor | |
Autos |
View facebook_batch_api.rb
This file contains 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
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 |
View link_tracking.coffee
This file contains 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
# Track clicks with Google Analytics and Mixpanel | |
# | |
# == How to use == | |
# Links that have the "data-track_event" attribute set will be tracked when clicked. | |
# | |
# == How it works == | |
# The to-be-tracked events are stored in a cookie and sends to the Google Analytics and Mixpanel | |
# with the next page requests. | |
# | |
# |
View gist:3623754
This file contains 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
<!-- 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> |
View localize_greeting.coffee
This file contains 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
################################################################## | |
# # | |
# Copyright (C) 2012 Dommmel <dommmel@gmail.com> # | |
# This code is released under WTFPL, version 2.0. # | |
# # | |
################################################################## | |
# Usage: | |
# <span id="sayhi">привет</span> | |
# <script> |
View create_gallery.rb
This file contains 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
#! /usr/bin/env ruby | |
require 'fileutils' | |
require 'erb' | |
require 'RMagick' | |
include Magick | |
template = ERB.new <<-EOF | |
<!DOCTYPE html> | |
<html> |
View capture_screenshot.js
This file contains 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
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(); |
View task_scheduler.rb
This file contains 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 '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 |
OlderNewer