This file contains hidden or 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
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; | |
if ([device hasTorch]) { | |
[device lockForConfiguration:nil]; | |
[device setTorchMode:AVCaptureTorchModeOn]; // AVCaptureTorchModeOff | |
[device unlockForConfiguration]; | |
} |
This file contains hidden or 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
// set any object | |
[[NSUserDefaults standardUserDefaults] setObject:@"this is some string" forKey:@"test"]; | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
// retrieve object | |
[[NSUserDefaults standardUserDefaults] objectForKey:@"test"]; |
This file contains hidden or 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
// to fill a table you need to implement the protocol UITableViewDataSource in the Header and implement this //methods: | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | |
{ | |
#warning Potentially incomplete method implementation. | |
// Return the number of sections. | |
return 0; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section |
This file contains hidden or 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
svn status | grep "^?" | awk '{print $2}' | xargs -I {} svn add {}@ |
This file contains hidden or 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
NSData *archivedData = [NSKeyedArchiver archivedDataWithRootObject:originalView]; | |
UIView *viewCopy = [NSKeyedUnarchiver unarchiveObjectWithData:archivedData]; |
This file contains hidden or 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
tell application "Growl" | |
-- Make a list of all the notification types | |
-- that this script will ever send: | |
set the allNotificationsList to {"iTunes Playing Track"} | |
-- Make a list of the notifications | |
-- that will be enabled by default. | |
-- Those not enabled by default can be enabled later | |
-- in the 'Applications' tab of the growl prefpane. | |
set the enabledNotificationsList to {"iTunes Playing Track"} | |
-- Register our script with growl. |
This file contains hidden or 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
useradd -d /home/user -s /bin/bash -m user | |
usermod -a -G group user |
This file contains hidden or 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
# encoding: UTF-8 | |
Encoding.default_internal = Encoding::UTF_8 | |
Encoding.default_external = Encoding::UTF_8 | |
require 'net/ftp' | |
require 'debugger' | |
require 'fileutils' | |
module Net | |
class FTP | |
def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data |
This file contains hidden or 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
require 'formula' | |
class Gsl < Formula | |
url 'http://ftp.gnu.org/gnu/gsl/gsl-1.14.tar.gz' | |
mirror 'http://ftpmirror.gnu.org/gsl/gsl-1.14.tar.gz' | |
homepage 'http://www.gnu.org/software/gsl/' | |
md5 'd55e7b141815412a072a3f0e12442042' | |
option :universal | |
def install |
This file contains hidden or 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
// by Marcus Zarra | |
#ifdef DEBUG | |
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) | |
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] | |
#else | |
#define DLog(...) do { } while (0) | |
#ifndef NS_BLOCK_ASSERTIONS | |
#define NS_BLOCK_ASSERTIONS | |
#endif | |
#define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) |