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
// | |
// MyApplication.m | |
// IdleTimer | |
// | |
// Created by Yannick Weiss on 21.06.10. | |
// Copyright 2010 __MyCompanyName__. All rights reserved. | |
// | |
#import "MyApplication.h" | |
#import "IdleTimerContainer.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
@interface MyApplication : NSApplication { | |
NSTimer *idleTimer; | |
NSMutableArray *idleTimerObjects; | |
unsigned int elapsedSeconds; | |
} | |
- (void)sendEvent:(NSEvent *)anEvent; | |
- (void)timerInvocation; | |
- (BOOL)isUser5SecondsIdle; | |
- (void)finishIdle; |
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
dispatch_queue_t queue = dispatch_queue_create(“com.app.task”,NULL) | |
dispatch_queue_t main = dispatch_get_main_queue(); | |
dispatch_async(queue,^{ | |
CGFLoat num = [self doSomeMassiveComputation]; | |
dispatch_async(main,^{ | |
[self updateUIWithNumber:num]; | |
}); | |
}); |
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 | |
// | |
#import "NSURLProtocol+Fix.h" | |
int main(int argc, char *argv[]) | |
{ | |
[NSURLProtocol fix]; | |
return NSApplicationMain(argc, (const char **) argv); |
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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>My shiny site</title> | |
<!-- used some CSS from https://github.com/twbs/bootstrap/blob/v4-dev/dist/css/bootstrap-reboot.css --> | |
<style> | |
html { |
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
NSMutableArray* topLevelObjs = [NSMutableArray array]; | |
NSDictionary* nameTable = [NSDictionary dictionaryWithObjectsAndKeys:self, NSNibOwner, topLevelObjs, NSNibTopLevelObjects, nil]; | |
if (![[NSBundle mainBundle] loadNibFile:@"bla" externalNameTable:nameTable withZone:nil]) { | |
NSLog(@"trouble loading bla.xib"); | |
return; | |
} | |
for (id object in topLevelObjs) { | |
if ([object isKindOfClass:[NSWindow class]]) { | |
[object makeKeyAndOrderFront:nil]; | |
break; |
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/sh | |
RESULT=$(xcodebuild -configuration Debug RUN_CLANG_STATIC_ANALYZER=YES) | |
if `echo ${RESULT} | grep "generated." 1>/dev/null 2>&1` | |
then | |
echo "commit failed: anaylzer error found" | |
exit 1 | |
fi |
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 | |
define(DEBUG, 0); | |
$supported_languages = array("en", "de"); | |
$default_language = "en"; | |
$language = $default_language; | |
if (isset($_POST['lang']) && in_array($_POST['lang'], $supported_languages)) { // Detecting if param was set | |
$language = $_POST['lang']; | |
setcookie("language", $language, time()+ (3600 * 24 * 30)); // cache 30 days | |
if (DEBUG) echo "found parameter lang " .$language; |
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
var r = new marked.Renderer() | |
var oldCode = r.code; | |
r.code = function(code, lang) { | |
if (lang === "gist") { | |
return '<code gist="https://gist.github.com/' + code + '.json"></code>'; | |
} else { | |
return oldCode(code, lang); | |
} | |
} |
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 | |
/usr/bin/ssh git@op6 expand > repos.txt | |
myarr=($(awk '{print $NF}' repos.txt)) | |
counter=0 | |
for i in "${myarr[@]}" | |
do | |
counter=$(($counter+1)) | |
if [ "$counter" -eq 1 ] || [ "$counter" -eq 2 ] | |
then |
OlderNewer