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 / 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
{
"data": {
"id": "43917710-36f0-4e41-9767-786f744fb1bd",
"type": "containeroutlet",
"attributes": {
"position": 0,
"name": "Any Layout",
"is_searchable": false,
"help_text": "Any description for any layout",
"is_array": false
!#/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 / gulpfile.js
Created March 2, 2015 12:55
Static site generator Gulpfile with Sass, Browserify and LiveReload
'use strict';
var argv = require('minimist')(process.argv.slice(2));
var browserify = require('browserify');
var browserSync = require('browser-sync');
var buffer = require('vinyl-buffer');
var frontmatter = require('front-matter');
var gulp = require('gulp');
// var path = require('path');
var source = require('vinyl-source-stream');
@pichfl
pichfl / pichfl.zshtheme
Last active December 20, 2015 01:19
My personal zsh theme for oh my zsh
# This theme is a small multiline modification of the fantastic robbyrussell.zsh-theme.
# Fix rendering errors when using multibyte characters
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
prompt_context() {
local user=`whoami`
if [[ -n "$SSH_CLIENT" ]]; then
echo "%{$fg_bold[blue]%}%n$fg_bold[red]%}@%m%{$reset_color%}"
// sample array
const rolling = [2, 4, 6, 8, 15];
// Returns the average of an array of numeric values
function average(arr) {
// .reduce() with a simple callback creates the sum of all values inside the array
// dividing by the length of the array to get the average
return arr.reduce((a, b) => a + b) / arr.length;
}
const argv = require('minimist')(process.argv.slice(2));
const readFileSync = require('fs').readFileSync;
const join = require('path').join;
const configFilePath = argv.config;
const config = JSON.parse(readFileSync(join(__dirname, '..', 'config.json')));
if (configFilePath) {
// Read config file defined by param from disk
const configFile = readFileSync(configFilePath);