Skip to content

Instantly share code, notes, and snippets.

@jeremiegirault
jeremiegirault / unfuck_eclipse.sh
Created August 3, 2012 09:35
Unfuck eclipse workspace script
#!/bin/bash
# put this file at the root of your workspace (next to .metadata folder)
rm -rf .metadata/.lock
rm -rf .metadata/.plugins/org.eclipse.core.resources/.snap
@jeremiegirault
jeremiegirault / start_vnc.sh
Created August 23, 2012 13:42
start vnc server in compatibility mode on OSX
#!/bin/bash
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all -clientopts -setvnclegacy -vnclegacy -yes -setvncpw -vncpw somesecretpassword
@jeremiegirault
jeremiegirault / downscale.sh
Created February 6, 2013 15:34
Downscale retina images to non-retina. Usefull for adding a build phase to xcode.
#!/bin/bash
# Downsamples all retina ...@2x.png images.
echo "Downsampling retina images..."
dir=$(pwd)
find "$dir" -name "*@2x.png" | while read image; do
outfile=$(dirname "$image")/$(basename "$image" @2x.png).png
// usage : HEX(0xB5C5D2)
#define HEX(hex) [UIColor colorWithRed:(((hex) >> 16)&0x000000FF)/255.0 green:(((hex) >> 8)&0x000000FF)/255.0 blue:((hex)&0x000000FF)/255.0 alpha:1.0]
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// show main window
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.home = [[HomeViewController alloc] init];
UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.home];
[self.window setRootViewController:nav];
[self.window makeKeyAndVisible];
// register for push if needed
@jeremiegirault
jeremiegirault / fallthrough.swift
Last active August 29, 2015 14:22
fallthrough in swift
enum State {
case Begin
case Changed
case End
}
let state: State = .Begin
switch(state) {
case .Begin, .Changed:
@jeremiegirault
jeremiegirault / bug1-crash.txt
Created September 21, 2015 08:12
Crashes RAC3
Process: rac-bug [45562]
Path: /Users/USER/Library/Developer/CoreSimulator/Devices/1F33AA4E-773A-4C39-A87A-209C75361233/data/Containers/Bundle/Application/207036DA-A1D0-462A-AD1F-B5C0DC42B064/rac-bug.app/rac-bug
Identifier: rac-bug
Version: 1.0 (1)
Code Type: X86-64 (Native)
Parent Process: launchd_sim [45276]
Responsible: launchd_sim [45276]
User ID: 501
Date/Time: 2015-09-21 10:06:42.848 +0200
@jeremiegirault
jeremiegirault / protocol-retrofit.swift
Created December 4, 2015 10:04
Protocol retrofitting for constrained generic extension in swift
let myString: String? = nil
protocol PossiblyEmpty {
var isEmpty: Bool { get }
}
extension String: PossiblyEmpty {}
extension Optional where Wrapped: PossiblyEmpty {
var isEmpty: Bool {
@jeremiegirault
jeremiegirault / retrofit-1.swift
Created December 4, 2015 10:21
Protocol retrofitting for constrained generic extension in swift
let myString: String? = …
if myString?.isEmpty ?? true { … }
@jeremiegirault
jeremiegirault / retrofit-2.swift
Created December 4, 2015 10:22
Protocol retrofitting for constrained generic extension in swift
let myString: String? = …
if myString.isEmpty { … }