Skip to content

Instantly share code, notes, and snippets.

@jk
jk / enterprise_token.rb
Created June 9, 2025 05:48 — forked from markasoftware/enterprise_token.rb
OpenProject Enterprise mode for free
############ If you are using DOCKER all-in-one image, create Dockerfile like: ################
############ FROM openproject/openproject:16 ################
############ COPY ./enterprise_token.rb app/models/enterprise_token.rb ################
############ If you are runing a manual installation: ################
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ If using some other set up (eg docker-compose), read the comments on ################
############ https://gist.github.com/markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 ################
// Playground - noun: a place where people can play
import Cocoa
struct Regex {
let pattern: String
let expressionOptions: NSRegularExpressionOptions
let matchingOptions: NSMatchingOptions
init(pattern: String, expressionOptions: NSRegularExpressionOptions, matchingOptions: NSMatchingOptions) {
@jk
jk / fix-xcode
Created January 17, 2014 15:33 — forked from rnapier/fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <[email protected]>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
Pod::Spec.new do |s|
s.name = 'SYCache'
s.version = '1.0'
s.license = 'MIT'
s.summary = 'Fancy caching with on-disk persistence'
s.homepage = 'https://github.com/Synthetic/SYCache'
s.author = { 'Sam Soffes' => '[email protected]' }
s.source = { :git => 'https://github.com/Synthetic/SYCache.git', :commit => 'origin/master' }
s.source_files = 'SYCache.{h,m}'
s.description = 'Simple in memory and on disk cache. It\'s backed by an NSCache in memory, ' \

Creating a bootable OS X Mavericks USB installer

  • First, plug in an 8GB (or bigger) USB drive, and use Disk Utility to erase it
  • If you use the default settings, you should wind up with a blank drive at /Volumes/Untitled.

With that volume in place, and with the Mavericks installer sitting in /Applications/Install\ OS\ X\ Mavericks.app, run the following command in your terminal to create a bootable install media:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
UIDevice *device = [UIDevice currentDevice];
SEL selector = NSSelectorFromString([device.systemVersion hasPrefix:@"7"] ? @"_deviceInfoForKey:" : @"deviceInfoForKey:");
NSLog(@"DeviceColor: %@ DeviceEnclosureColor: %@", [device performSelector:selector withObject:@"DeviceColor"], [device performSelector:selector withObject:@"DeviceEnclosureColor"]);
@jk
jk / weak.m
Last active December 23, 2015 23:49 — forked from krzysztofzablocki/gist:6711189
- (void)main {
__weak id obj;
// Wrong:
dispatch_async(queue, ^() {
[obj doSomething];
[obj doSomethingElse]; // can turn to nil at any point, should store in strong at beggining of block
[obj doSomethingElse2];
});
@jk
jk / FeatureContext.php
Last active February 14, 2019 16:37 — forked from michalochman/gist:3175175
Take screenshots with Behat + Mink + Selenium2 Stack when a step fails. CAUTION: Work in progress
<?php
use Behat\Behat\Event\StepEvent;
use Behat\Gherkin\Node\StepNode,
Behat\Gherkin\Node\ScenarioNode,
Behat\Gherkin\Node\FeatureNode;
use Behat\Mink\Driver\Selenium2Driver;
/**
@jk
jk / test.rb
Created March 10, 2013 13:54 — forked from subdigital/test.rb
# based on https://gist.github.com/3349345
# Thanks, @alloy!
#
# To get your project ready for this, you'll have to create a scheme for your unit test project, make sure run is checked in
# the build step, and then delete the Test Host setting.
# Also, make sure you have the colored and open4 gems installed.
require 'rubygems'
require 'colored'
require 'pathname'
#! /bin/sh
# Takes a provisioning profile and installs it into the system path.
# This requires poking inside the provisioning profile and searching for the
# UUID present at the end of the file.
set -e
if [[ -z "$1" ]]
then