Skip to content

Instantly share code, notes, and snippets.

View pichfl's full-sized avatar
👨‍🎨
No mistakes, only happy accidents.

Florian Pichler pichfl

👨‍🎨
No mistakes, only happy accidents.
View GitHub Profile
@pichfl
pichfl / .gitignore
Created December 16, 2011 11:11
My personal gitignore file, add with git config --global core.excludesfile ~/.gitignore
#####
# OS X
.DS_Store
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
#####
# Textmate
@pichfl
pichfl / better_image_tag.rb
Created January 2, 2012 01:03
Liquid Image Tag for Jekyll
# A simple plugin for Jekyll that allows you to use {% url "alt text" %} to add images to your posts.
# It will automatically check those images for width and height.
#
# Requires http://imagesize.rubyforge.org/
require 'image_size'
require 'open-uri'
module Jekyll
@pichfl
pichfl / body.js
Created January 29, 2012 18:13
Super basic tabs with JavaScript: click/touch adds a class to the clicked element and to the element with the id of the clicked elements href.
(function(w,d) {
var q = 'querySelectorAll',
navs = d[q]('nav a'), // Tabs
pages = d[q]('section'), // Contents
a = 'active', // ClassName
cn="className",
aC=function(c,b){if(c.classList){c.classList.add(b)}else{var d=" ";var a=(d)?(d+c[cn]+d).indexOf(d+b+d)>-1:String(this).indexOf(b)>-1;if(!a){c[cn]=(c[cn]+" "+b)}}},
rC=function(b,a){if(b.classList){b.classList.remove(a)}else{b[cn]=b[cn].replace(new RegExp("(^|\\s)"+a+"(?:\\s|$)"),"$1")}};
for (var i=0; i < navs.length; i++) {
navs[i].savedPage = d[q](navs[i].href.match(/#.*$/)[0])[0];
@pichfl
pichfl / convert.sh
Created March 28, 2012 14:06
A quick and dirty bash file that converts a folder full of YYYY-MM-DD-*name*.markdown into folders with textfiles for use with Kirby CMS
#!/bin/bash
cd /folder/with/your/posts
COUNTER=1
for filename in *
do
echo "----" >> $filename
echo "Date: ${filename:0:10}" >> $filename
echo "----" >> $filename
@pichfl
pichfl / mobile-safari-fix.js
Created May 9, 2012 13:33
Mobile Safari Rotation Bug Fix
// by @pichfl, inspired by the work of @adactio, @mathias, @cheeaun, @jdalton and @scottjehl
if (/iPhone|iPad|iPod/.test(navigator.platform) && navigator.userAgent.indexOf('AppleWebKit') > -1) {
(function(w){
var d = w.document,
meta,
initialContent,
content = 'content',
ms = ',minimum-scale=0.5,maximum-scale=',
enabled,
to,
!#/bin/bash
buildPlist=${INFOPLIST_FILE}
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" $buildPlist
@pichfl
pichfl / gist:4020415
Created November 5, 2012 21:24
Teleport targets for our Minecraft server

Teleport Targets

  • @pichfl -477 72 -262
  • @ranez -1741 65 14
  • @blaw_blaw 1332 64 1432
  • Melvin 1148 70 1155
  • Castle 1074 73 1388
  • Docks 1024 66 1302
  • Skyland arrival 375 123 1088
  • Skyland Upper 361 133 1114
@pichfl
pichfl / update.sh
Created December 6, 2012 10:58
Update build number - use #!/bin/bash
buildPlist=${INFOPLIST_FILE}
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" $buildPlist)
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" $buildPlist
@pichfl
pichfl / gist:4275655
Created December 13, 2012 10:45
Softlight calculation
CGFloat calculateSoftlight(CGFloat a, CGFloat b) {
// via http://en.wikipedia.org/wiki/Blend_modes#Soft_Light
CGFloat f;
if ( b <= 0.5 ) {
f = a - (1 - 2 * b) * a * (1 - a);
} else {
CGFloat g;
if (a <= 0.25) {
@pichfl
pichfl / .zshrc
Last active February 5, 2018 12:27
My zsh config
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Oh My ZSH Configuration
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="pichfl"
# CASE_SENSITIVE="true"
# DISABLE_AUTO_UPDATE="true"
# export UPDATE_ZSH_DAYS=13