Skip to content

Instantly share code, notes, and snippets.

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

Dominik dommmel

💭
That worked!
View GitHub Profile
<!DOCTYPE html>
<html><head></head>
<!-- Standard Facebook Initialization -->
<body>
<div id="fb-root"></div>
<button>Loading...</button>
<script>
@dommmel
dommmel / generate_favicon.sh
Created March 12, 2013 17:39
Generate multi-resolution favicon with imagemagick
convert logo-solo.png -bordercolor white -border 0 \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -transparent white -colors 256 favicon.ico
@dommmel
dommmel / celluloid_pool.rb
Last active August 15, 2018 12:39
Parallelizing long running requests with celluloid
require 'celluloid'
require "benchmark"
require 'open-uri'
delay_seconds = [4,4,4,4,4,4]
BASE_URL = "http://slowapi.com/delay"
class Crawler
include Celluloid
def read(delay)
@dommmel
dommmel / random_refresh.js
Created June 4, 2013 10:11
refresh page on random intervals
function doSomething() {
open(location.href, 'refreshingWindow');
}
(function loop() {
var rand = Math.round(Math.random() * (10000)) + 1000;
setTimeout(function() {
doSomething();
loop();
}, rand);
@dommmel
dommmel / anno-parse-plugin.js
Last active December 16, 2023 20:30
Annotorious Plugin for Parse.com. A simple storage connector plugin to the Parse REST interface.
/**
* A simple storage connector plugin to the Parse REST interface.
*
* Note: the plugin requires jQuery to be linked into the host page.
*
* THIS PLUGIN IS FOR DEMO PURPOSES ONLY - DON'T USE IN A PRODUCTION
* ENVIRONMENT.
*/
@dommmel
dommmel / jquery.smoothscroll.js
Created July 4, 2013 09:35
jQuery smooth scroll to anchor
// use it like this: <a class="scroll" href="#destination1">Destination 1</a>
// <section id="destination1">Lore ipsum</section>
$(".scroll").click(function(event){
event.preventDefault();
//calculate destination place
var dest=0;
if($(this.hash).offset().top > $(document).height()-$(window).height()){
dest=$(document).height()-$(window).height();
}else{
@dommmel
dommmel / hide_adress_bar.js
Created September 13, 2013 11:14
Hide adress bar on iphone/android
// Hide adress bar on iphone/android
$(function() {
function hideURLbar() {
if (window.location.hash.indexOf('#') == -1) {
window.scrollTo(0, 1);
}
};
if (navigator.userAgent.indexOf('iPhone') != -1 || navigator.userAgent.indexOf('Android') != -1) {
addEventListener("load", function() {
setTimeout(hideURLbar, 0);
@dommmel
dommmel / Info.plist
Created October 10, 2013 10:44
Dial tel:// and sip:// links on your snom phone
<!-- add this to the dict node -->
<key>CFBundleIdentifier</key>
<string>com.apple.AppleScript.SnomDialer</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>SnomDialer</string>
<key>CFBundleURLSchemes</key>
-- Addressbook to SNOM export
-- Be sure to open Contacts app before running this script
set resultText to ""
set currentLine to ""
set numPhones to 0
tell application id "com.apple.AddressBook"
set the clipboard to people's vcard
-- Find the maximum number of phone numbers
repeat with x from 1 to the count of people
@dommmel
dommmel / gravatar.coffee
Created October 17, 2013 13:11
Retrieve Gravatar indenticon for a given email address via javascript. You need to include a md5 library (like http://www.myersdaily.org/joseph/javascript/md5-text.html)
# get the url of an emails gravatar image
#
# default_image can either be an image url or one of the following: mm, identicon, monsterid, wavatar, retro, blank
# (See https://de.gravatar.com/site/implement/images/ for all options)
#
# Example usage:
# get_gravatar_image_url("example@example.com", 80, "retro")
get_gravatar_image_url = (hashed_email, size=80, default_image="mm", force_default=false) ->
size = (if (size >= 1 and size <= 2048) then size else 80)