Skip to content

Instantly share code, notes, and snippets.

Ralf Ebert ralfebert

Block or report user

Report or block ralfebert

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ralfebert
ralfebert / slice.py
Last active Jul 29, 2019
Export images from Sketch to xcasset (by @ryangomba)
View slice.py
#!/usr/bin/env python
import os
import sys
import subprocess
import shutil
import json
import re
import time
from distutils.spawn import find_executable
@ralfebert
ralfebert / CompareImages.swift
Last active Feb 28, 2018 — forked from SheffieldKevin/compareimages.swift
A couple of swift functions for comparing two CGImage using CIImage in OS X
View CompareImages.swift
import CoreGraphics
import CoreImage
func imageMetadataString(image: CGImage) -> String {
return "\(image.width)x\(image.height) bitsPerComponent:\(image.bitsPerComponent) bytesPerRow:\(image.bytesPerRow) bitsPerPixel:\(image.bitsPerPixel)"
}
/**
@brief Returns the maximum difference of pixel values in the image.
@discussion Assumes doImagesHaveSameMeta has already returned true on
@ralfebert
ralfebert / generate_storyboard_constants.rb
Last active May 29, 2019
Generate Swift constants for Xcode storyboards containing cell reuse identifiers, segue identifiers and storyboard identifier. More information: https://www.ralfebert.de/storyboard-constants/
View generate_storyboard_constants.rb
#!/usr/bin/env ruby
require 'nokogiri'
def show_usage(msg = nil)
puts "#{msg}\n\n" if msg
puts "Usage:\n\t#{$PROGRAM_NAME} [storyboard_file]"
exit(0)
end
@ralfebert
ralfebert / xcode_set_development_language_de.rb
Last active Sep 25, 2019
Ruby script that uses cocoapods Xcodeproj to set development_region / known_regions of an Xcode project to German
View xcode_set_development_language_de.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'xcodeproj'
unless ARGV.count == 2
puts "Usage: xcode_set_development_region.rb [project] [region]"
exit(1)
end
View 0001-Fix-for-844-Incompatibility-haml-4.0.6-sprockets-3.0.patch
From 5366b677f1f7a1053de5904f96ba5108ffaf8953 Mon Sep 17 00:00:00 2001
From: Ralf Ebert <info@ralfebert.de>
Date: Thu, 7 May 2015 23:33:01 +0200
Subject: [PATCH] Fix for #844: Incompatibility haml (4.0.6) -> sprockets
(3.0.3) causing error 'wrong number of arguments' for inline :sass filter in
haml template
---
lib/haml/sass_rails_filter.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@ralfebert
ralfebert / swift-kvo-example.swift
Last active Mar 10, 2016 — forked from correia/swift-kvo-example.swift
Swift 1.1: dynamic for observable properties neccessary, observeValueForKeyPath signature changed
View swift-kvo-example.swift
//
// Swift-KVO
//
// Created by Jim Correia on 6/5/14.
// Copyright (c) Jim Correia. All rights reserved.
//
// Update: 6/17/2014
//
// KVOContext has gone away; use the same idiom you'd use from Objective-C for the context
View gist:6579711
git config --global alias.lg "log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr %an)%Creset' --abbrev-commit --date=relative"
@ralfebert
ralfebert / gist:5425624
Created Apr 20, 2013
git alias.clear resets working tree to HEAD
View gist:5425624
git config --global alias.clear '!git reset --hard;git clean -fd'
@ralfebert
ralfebert / gist:5382822
Last active Dec 16, 2015
git config core.editor
View gist:5382822
git config --global core.editor "nano -Y patch"
git config --global core.editor "'C:\Program Files (x86)\Notepad++\notepad++.exe' \
-multiInst -notabbar -nosession -noPlugin"
git config --global core.editor "gedit -w -s"
git config --global core.editor "mate -w"
@ralfebert
ralfebert / values.gnuplot
Created Apr 4, 2013
Plotting and fitting values to a linear equation from CSV data with gnuplot
View values.gnuplot
set datafile separator ';'
set terminal png
set output 'values.png'
f(x) = a*x + b
fit f(x) 'values.csv' using 1:2 via a, b
plot 'values.csv' using 1:2, f(x) title sprintf('%.2fx + %.2f', a, b)
You can’t perform that action at this time.