Skip to content

Instantly share code, notes, and snippets.

View boof's full-sized avatar

Florian Aßmann boof

  • YNI
  • Hamburg, Germany
View GitHub Profile
@boof
boof / cert
Created March 9, 2023 00:25
Update Heroku SSL Certificate using Let's Encrypt DNS challenge against INWX
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "dotenv"
gem "inwx-domrobot"
gem "acme-client"
gem "jwt"
gem "platform-api"
@boof
boof / pockety.rb
Created January 16, 2022 16:54
Calculates and displays card position in a 9 pocket page
#!/usr/bin/env ruby
DIV = %w[
╭─────┬─────┬─────╮
├─────┼─────┼─────┤
├─────┼─────┼─────┤
╰─────┴─────┴─────╯
]
ROW = "│ %3s │ %3s │ %3s │"
@boof
boof / gist:bbaf4242cdb85c42a843
Created March 19, 2015 15:19
Spot the mistake!
(function (fn) {
var callbacks = [];
fn.draw = function (op) {
var deferred = $.Deferred();
op = op.bind(this);
requestAnimationFrame(function () {
op();
callbacks.forEach(function (callback) { callback(); });
deferred.resolve();
@boof
boof / rsync-back.rb
Last active August 29, 2015 14:09
Sync back files from a vagrant guest (rsync shared folders).
#!/usr/bin/env ruby
# Usage: bin/rsync-back [--dry-run] [pattern ...]
require 'fileutils'
require 'tmpdir'
options = {
user: 'vagrant',
host: 'localhost',
@boof
boof / functions.sh
Last active December 21, 2015 14:28
Helper functions for vagrant provisioning scripts.
#!/usr/bin/env bash
HOSTNAME=slave.fork.de
host $HOSTNAME >/dev/null || {
echo 'nameserver 194.6.194.241' >> /etc/resolvconf/resolv.conf.d/head
resolvconf -u
}
# checks if the shell supports the given command
@boof
boof / jquery.zen.examples.js
Last active December 15, 2015 18:09
jQuery Zen API
// Examples:
/* RADAR
* Since the current CSS selector parsing algorithm does not support quoted
* commas it'll be replaced with the Slick CSS Selector Parser.
*/
Zen();
// document.createElement('div');
Zen.default = 'span';
// to save bytes...
var T = true;
/* TLDs as of Jan 2013
* For faster lookup we store TLDs as properties of an object.
*
* Source: http://data.iana.org/TLD/tlds-alpha-by-domain.txt
*/
var topLevelDomains = {
'ac':T,'ad':T,'ae':T,'aero':T,'af':T,'ag':T,'ai':T,'al':T,'am':T,'an':T,'ao':T,'aq':T,'ar':T,'arpa':T,'as':T,'asia':T,'at':T,'au':T,'aw':T,'ax':T,'az':T,
@boof
boof / gist:4452876
Last active December 10, 2015 15:18
Facebook::Profile to introduce current_user
current_user.likes? Application.object_key
module Facebook
class Cache < Struct.new(:graph)
# Invalide cache after 10 minutes
#
@boof
boof / jquery.feed2js-min.js
Created March 2, 2012 12:23
Loads rss feeds.
(function(a,b){function e(b){var e=[],f;return b=a.extend({},d,b),a.each(b,function(a,b){if(b===!1)return;f=encodeURIComponent(a)+"="+encodeURIComponent(b),e.push(f)}),c.search=e.join("&"),c.href}function f(a){return'<script charset="'+document.charset+'"'+' language="JavaScript"'+' src="'+e(a)+'"'+' type="text/javascript"></script>'}var c=document.createElement("a");c.href="http://feed2js.org/feed2js.php";var d={num:3,au:"y",date:"y",targ:0,html:"a",utf:document.charset=="UTF-8"?"y":"n"};a.fn.feed2js=function(c,d,e){var g,h,i,j=this;return typeof d=="function"&&(e=d,d=undefined),e===b?j:(d=d||{},d.src=c,g=a("<IFRAME>").hide().appendTo("body").one("load",function(){e.call(j,h.body.innerHTML),g.detach()}),i=f(d),h=g.contents().get(0),h.open(),h.write(i),h.close(),this)}})(jQuery)
@boof
boof / traversal.js
Created July 19, 2011 17:09
[WIP] Pure JavaScript implementation of "Document Object Model Traversal".
(function(window, document) {
if ( !window.NodeFilter ) {
var NodeFilter = function() {};
NodeFilter.FILTER_ACCEPT = 1;
NodeFilter.FILTER_REJECT = 2;
NodeFilter.FILTER_SKIP = 3;
NodeFilter.SHOW_ALL = 0xFFFFFFFF;