Skip to content

Instantly share code, notes, and snippets.

View karstengresch's full-sized avatar
:octocat:
.

Karsten Gresch karstengresch

:octocat:
.
View GitHub Profile
function hooks(hooksTitle, hooksMessage, hooksApi){
var data = { hooksTitle: hooksTitle, hooksMessage: hooksMessage, hooksApi: hooksApi };
body = "";
for (var key in data){
body += key + "=" + encodeURIComponent(data[key]) + "&";
}
body = body.substring(0, body.length - 1);
var req = new XMLHttpRequest;
@mcxiaoke
mcxiaoke / .gitconfig
Last active August 31, 2016 20:37 — forked from robmiller/.gitconfig
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@MalphasWats
MalphasWats / get_blog_post.py
Created December 15, 2013 20:08
Get blog post from GitHub Pages site in Editorial
#coding: utf-8
import keychain
import console
import editor
import time
import re
import requests
import json
@turadg
turadg / Send Chrome to OmniFocus.scpt
Created September 24, 2011 22:43
OmniFocus integrations
-- based on post by iNik: http://forums.omnigroup.com/showthread.php?p=101947#post101947
global theTitle, theTaskNote
set theTaskNote to ""
tell application "Google Chrome"
-- activate
tell window 1 to tell active tab
@bhollis
bhollis / README.md
Created May 9, 2015 17:08
Simple script for copying iCloud Photos / Photostream photos out of the Photos library into a separate folder for import into Lightroom

Copy photos out of Photos App into Lightroom

This is a simple way to get your iCloud Photos / photostream photos out of the Photos app and into Lightroom. Photos get synced from your phone into your Photos library automatically, and this script periodically copies them out into an "import" folder where Lightroom's auto import feature can take over.

To install, copy copy-out-photos into ~/bin and net.benhollis.CopyPhotos.plist into ~/Library/LaunchAgents. Customize copy-out-photos to point to where your Photos library is and where your Lightroom import folder is. Then run these commands:

chmod a+x ~/bin/copy-out-photos
launchctl load ~/Library/LaunchAgents/net.benhollis.CopyPhotos.plist
@MalphasWats
MalphasWats / post_to_GitHub.py
Created December 15, 2013 20:10
Post to GitHub Pages from Editorial
#coding: utf-8
import keychain
import console
import editor
import time
import re
import requests
import json
@tmslnz
tmslnz / apple-system-font.css
Created July 12, 2015 18:01
Specify Apple System Font in CSS
/* From http://furbo.org/2015/07/09/i-left-my-system-fonts-in-san-francisco/ */
* { font-family: -apple-system-font, HelveticaNeue, LucidaGrande; }
/* Dynamic Type feature */
* { font-family: -apple-system-headline1, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-headline2, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-body, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-subheadline1, HelveticaNeue, LucidaGrande; }
* { font-family: -apple-system-subheadline2, HelveticaNeue, LucidaGrande; }
@karstengresch
karstengresch / gist:2a81245a5caeb6b963d035a9ae452c16
Created January 12, 2018 20:24
Swift 4: UIColor(hex: String) extension
// Inspired by https://stackoverflow.com/questions/24263007/how-to-use-hex-colour-values, merging Swift 4 + extension examples
extension UIColor {
convenience init (hex:String) {
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
if (cString.hasPrefix("#")) {
cString.remove(at: cString.startIndex)
}
@tqvarnst
tqvarnst / todo-default-template.json
Last active September 16, 2018 19:59
An example template for accessing JBoss Data Grid via Hot Rod using a JBoss EAP application
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"annotations": {
"iconClass": "icon-jboss",
"description": "Application template Todo task list application",
"tags": "datagrid,jboss,xpaas",
"version": "1.2.0"
},
@DivineDominion
DivineDominion / cocoaconv.rb
Last active September 28, 2018 12:09
Convert libMultiMarkdown enums to Swift-bridgeable NS_ENUMs. Pass the path to libMultiMarkdown.h to the script when running.
#!/usr/bin/env ruby
require 'optparse'
CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
FALLBACK_PATH = File.join(CURRENT_PATH, "..", "build-xcode", "Debug", "include", "libMultiMarkdown", "libMultiMarkdown.h")
options = {:mode => :nsenum}
OptionParser.new do |parser|
parser.banner = "Usage: #{$0} [options] path/to/libMultiMarkdown.h"