View gist:114115
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
-(NSDictionary *)readDatafile:(NSString *)plistfile { | |
NSLog(@"Reading PLIST file %@", plistfile); | |
return [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:plistfile ofType:@"plist"]]; | |
} |
View occurances.py
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
def countwordsInString(string, delimiter, word): | |
occurs = 0 | |
stringarray = string.split(delimiter) | |
for stringword in stringarray: | |
if word == stringword: | |
occurs = occurs + 1 | |
return occurs |
View gist:121282
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 | |
function countwordsInString($string, $delimiter, $word) { | |
$occurs = 0; | |
foreach (explode($delimiter, $string) as $stringword) if ($word == $stringword) $occurs++; | |
return $occurs; | |
} | |
?> |
View gist:121949
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 | |
foreach (scandir("Downloads") as $f) if ((substr($f, -3, 3) == "txt" || substr($f, -3, 3) == "csv") && stristr(strtolower($f), "errors")) echo $f."\n"; | |
?> |
View gist:122068
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
perl -pi -e "s/\r\n/\n/" $1 |
View gist:122092
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 | |
$memcache = new Memcache; | |
$memcache->connect('a.b.c.d', 11211); | |
$memcache->set('test', 'This could be an array or an object (the methods wont get saved!', false, 600); | |
$retrieval = $memcache->get('test'); | |
if ($retrieval) print_r($retrieval); | |
?> |
View gist:122904
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
Set fso = CreateObject(Scripting.FileSystemObject) | |
Set f = fso.GetFile("Path\to\file") | |
MsgBox CLng(DateDiff("s", f.DateLastModified, Now)) |
View gist:123507
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 | |
foreach ($cmds as $cmd) { | |
$pid=pcntl_fork(); | |
if ($pid) { | |
exec($cmd); | |
break; | |
} | |
} | |
?> |
View gist:126220
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
for($a=1;$a<=11;$a++){if($a==1){print "h";}elsif($a==2){print "e";}elsif($a==3 or $a==4 or $a==10){print "l";}elsif($a==5 or $a==8){print "o";}elsif($a==11){print "d";}elsif($a==7){print "w";}elsif($a==9){print "r";}else{print " ";}} |
View gist:126455
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 | |
// Found this on the web | |
// Requirements: PHP + COM + Win32 (duh) | |
// DISCLAIMER: Found this on the web. Have not tested this yet, but it would come in handy | |
$qcurl =$_GET["qcurl"]; | |
$usr =$_GET["usr"]; | |
$pwd =$_GET["pwd"]; | |
$dmn =$_GET["dmn"]; |
OlderNewer