Skip to content

Instantly share code, notes, and snippets.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docDirectory = [paths objectAtIndex:0];
self.filePath = [docDirectory stringByAppendingPathComponent:@"boardContents.plist"];
2009-08-12 21:46:35.976 Clipped[2917:20b] Plain Text: image3.jpg
2009-08-12 21:46:54.544 Clipped[2917:20b] {
item = {
"public.jpeg" = <UIImage: 0x3d35730>;
"public.utf8-plain-text" = "image3.jpg";
};
}
<?php
$imglist = array();
//$img_folder is the variable that holds the path to the banner images. Mine is images/tutorials/
// see that you don't forget about the "/" at the end
mt_srand((double)microtime()*1000);
//use the directory class
$imgs = dir('./');
Some of us never see the light
Until it's out of sight
Give up without a fight
Some of us fall and never get up
Swear that it's not their fault
Swear that it's not their fault
Evolution will turn your life around
From feeling safe and sound
To the lost and found
def pictures
@picture = Picture.new(params[:picture])
@picture.data_content_type = MIME::Types.type_for(params[:Filename]).to_s
@picture.recipe_id = params[:recipe_id]
respond_to do |format|
if @picture.save
flash[:notice] = "Saved the picture."
format.html { redirect_to recipe_path(params[:recipe_id]) }
format.js
Party al the time, party al the time
Party al the time, party al the time
If, if we could party al night and slep al day
And throw al of my problems away
<?php
function twitauth($username, $password){
$xml = @simplexml_load_file("http://". $username .":". $password ."@twitter.com/statuses/friends_timeline.xml");
return ($xml->error != "Could not authenticate you.") ? true : false;
}
?>
<?php
$i = 0;
$vars = array('a', 'b', 'c', 'd', 'e', 'f');
foreach($vars as $var) {
if($i==2) break;
// do what you want
++$i;
}
@dewski
dewski / gist:184249
Created September 10, 2009 02:25 — forked from markbates/gist:154957
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
// Delegation methods
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
Device *device = [[Device alloc] init];
device.token = [devToken description];
(function($){$.fn.reset=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};$.fn.enable=function(){return this.each(function(){this.disabled=false})};$.fn.disable=function(){return this.each(function(){this.disabled=true})}})(jQuery);(function($){$.extend({fieldEvent:function(el,obs){var field=el[0]||el,e="change";if(field.type=="radio"||field.type=="checkbox"){e="click"}else{if(obs&&(field.type=="text"||field.type=="textarea"||field.type=="password")){e="keyup"}}return e}});$.fn.extend({delayedObserver:function(delay,callback){var el=$(this);if(typeof window.delayedObserverStack=="undefined"){window.delayedObserverStack=[]}if(typeof window.delayedObserverCallback=="undefined"){window.delayedObserverCallback=function(stackPos){var observed=window.delayedObserverStack[stackPos];if(observed.timer){clearTimeout(observed.timer)}observed.timer=setTimeout(function(){observed.timer=null;observed.callback(observed.obj,observed.