Skip to content

Instantly share code, notes, and snippets.

View sftsk's full-sized avatar

Lukas Jakob Hafner sftsk

View GitHub Profile
@sftsk
sftsk / countTo.js
Created March 13, 2015 09:52
small jQuery plugin to animate a counting to number
(function($) {
$.fn.countTo = function(options) {
// merge the default plugin settings with the custom options
options = $.extend({}, $.fn.countTo.defaults, options || {});
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(options.speed / options.refreshInterval),
increment = (options.to - options.from) / loops;
return $(this).each(function() {
@sftsk
sftsk / stopwatch.php
Created March 17, 2015 13:59
Measure how long something takes in php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
// do something in here
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
@sftsk
sftsk / .htaccess
Created March 24, 2015 08:41
www to non-www redirect .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
@sftsk
sftsk / gem installs osx
Last active August 29, 2015 14:17
install nokogiri osx yosemite
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2 --use-system-libraries
@sftsk
sftsk / wpml-resave.js
Last active August 29, 2015 14:20
hacky trigger for wpml translation re-save
var saveTranslations = function (el) {
var popupId = '#' + el.attr('id').replace('-', '-popup-');
el.trigger('click');
jQuery(jQuery(popupId).find('.term-save')).trigger('click');
var waitForClose = window.setInterval(function () {
if (jQuery(popupId).text() === '') {
window.clearInterval(waitForClose);
var nextRow = jQuery('#' + el.attr('id')).closest('tr').next('tr');
if (nextRow.length > 0) {
console.log('next row');
@sftsk
sftsk / osx-reverse-proxy
Created May 2, 2015 13:19
set up reverse proxy on osx server
I have changed the way I am doing reverse proxy on Mountain Lion Server. On my old Snow Leopard Server system, I looked at how it set-up Reverse Proxy. Configuring Reverse Proxy from the GUI, in Snow Leopard Server, added the following to the site configuration file (after the <IfModule mod_ssl.c> ~ </IfModule> section):
<IfModule mod_proxy_balancer.c>
ProxyPass / balancer://balancer-group/
ProxyPassReverse / balancer://balancer-group
<Proxy "balancer://balancer-group">
BalancerMember http://my.example.com:8080
</Proxy>
</IfModule>

In general for Wordpress the server needs the following:

https://wordpress.org/about/requirements/

In order for us to deploy to the server easily we will need the following as well:

  • folder with write permission on the server
  • domain pointing to the server and vhost set up to folder/current/web
  • ssh access to the server (with key authentication)
  • the server has to be able to run git & composer
@sftsk
sftsk / calendarpi.md
Last active May 12, 2021 21:19
Raspberry Pi Google Calendar Screen

Using a raspberry pi to display Google Calendars

This explains the set up of our very basic status screen to displays Google calendars here at booncon.

Install the raspberry pi

Download and put the most current https://www.raspberrypi.org/downloads/raspbian/ image to an SD Card. On OSX that works great with http://www.tweaking4all.com/hardware/raspberry-pi/macosx-apple-pi-baker/, just use the restore option and select the unzipped image file.

Set up the operation system basics

After the first boot, the raspi-config utility should load up.

@sftsk
sftsk / wp-plugin-list.js
Created April 21, 2016 14:43
JS Scriplet that creates a list of the active plugins of a WordPress installation. Useful when needed for a site documentation or similar
// v0.1
// @saftsaak
// got tt the plugins page, open the developer tools on your browser, paste this, hit enter and then copy-paste the output from the console log
var pList = "";
jQuery('#the-list tr.active:not(.plugin-update-tr)').each(function () {
var $this = jQuery(this);
var pTitle = jQuery('.plugin-title strong', $this).text();
var pVersion = jQuery('.plugin-version-author-uri', $this).text();
var pDesc = jQuery('.plugin-description', $this).text();