This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /tmp | |
rm -rf /tmp/Dux | |
git clone https://github.com/abhibeckert/Dux.git | |
cd Dux | |
xcodebuild -target Dux -configuration Release | |
rm -r /Applications/Dux.app | |
mv build/Release/Dux.app /Applications/Dux.app | |
open /Applications/Dux.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Preferences | |
{ | |
"drag_text": true, | |
"find_selected_text": false, | |
"move_to_limit_on_up_down": true, | |
} | |
// Key Bindings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// span-image-across-displays | |
// | |
// Created by Abhi Beckert on 2013-2-19. | |
// Copyright (c) 2013 Abhi Beckert. All rights reserved. | |
// | |
#import <Cocoa/Cocoa.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import <Foundation/CPObject.j> | |
@import "PageView.j" | |
@import "PhotoInspector.j" | |
@implementation AppController : CPObject | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import <Carbon/Carbon.h> | |
int main(int argc, const char * argv[]) | |
{ | |
@autoreleasepool { | |
// get list of running apps | |
NSMutableArray *runningApps = [NSMutableArray array]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)applicationDidEnterBackground:(UIApplication *)application | |
{ | |
[self update]; | |
self.backgroundTaskIdentifier = | |
[application beginBackgroundTaskWithExpirationHandler:^(void) { | |
@autoreleasepool { | |
NSLog(@"begin in background after 10 minutes"); | |
[motionManager stopAccelerometerUpdates]; | |
motionManager.accelerometerUpdateInterval = 0.2f; | |
[self update2]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// DuxTextView.m | |
// DuxTextView | |
// | |
// Created by Abhi Beckert on 19/10/2013. | |
// Copyright (c) 2013 Abhi Beckert. All rights reserved. | |
// | |
#import "DuxTextView.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$imgData = file_get_contents($path); | |
// determine mime type | |
$magicNumbersToMimeTypes = array( | |
'474946383761'=>'image/gif', // GIF87a type gif | |
'474946383961'=>'image/gif', // GIF89a type gif | |
'89504E470D0A1A0A'=>'image/png', // png | |
'FFD8FFE0'=>'image/jpeg', // JFIF jpeg | |
'FFD8FFE1'=>'image/jpeg', // EXIF jpeg | |
'FFD8FFE8'=>'image/jpeg', // SPIFF jpeg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$substitution = '5tv0WiPg2YoSNCRzzBUZc7Bozp2WhLmODSMmc8qlTNh8MdUJVyPx9lj3vngJzFn'; | |
$regexPattern = str_replace('*', $substitution, $customRulePattern); // replace "*" with random substitution, to avoid being preg_quote() escaped | |
$regexPattern = preg_quote($regexPattern); // escape all regex syntax | |
$regexPattern = str_replace('/', '\/', $regexPattern); // also escape the "/" character, since we are using that as the preg delimiter | |
$regexPattern = str_replace($substitution, '.*', $regexPattern); // convert $substitution into the correct regex pattern | |
$regexPattern = "/$regexPattern/s"; // wrap in / and add the "DOTALL" flag | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func foo(closure: Void -> Void) | |
{ | |
closure() | |
} | |
// correct syntax | |
foo({ | |
println("Hello") | |
}) |
OlderNewer