Skip to content

Instantly share code, notes, and snippets.

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

Dominik dommmel

💭
That worked!
View GitHub Profile
-- 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 / 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>
@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 / 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 / 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 / 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
<!DOCTYPE html>
<html><head></head>
<!-- Standard Facebook Initialization -->
<body>
<div id="fb-root"></div>
<button>Loading...</button>
<script>
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
@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 / 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>