Skip to content

Instantly share code, notes, and snippets.

if goals.select{|g| g.status != 'awaiting' && g.open }.length > 0
logic
end
NSString *longURL = @"http://mugunthkumar.com"
NSString *baseURLString =
@"http://api.bit.ly/shorten?version=2.0.1&longUrl=%@&login=bitlyapidemo&apiKey=";
NSString *urlString = [[NSString alloc] initWithFormat:@"%@%@",
baseURLString, longURL];
NSURL *url = [[NSURL alloc] initWithString:urlString];
NSString *result = [[NSString alloc] initWithContentsOfURL:url];
NSLog(result);
[url release];
[urlString release];
- (void)viewDidLoad {
[super viewDidLoad];
UIBarButtonItem *btnSettings = [[UIBarButtonItem alloc] initWithTitle:@"Settings"
style:UIBarButtonItemStylePlain target:self action:@selector(displaySettings:)];
self.navigationItem.rightBarButtonItem = btnSettings;
[btnSettings release];
}
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy"];
//Optionally for time zone converstions
[formatter setTimeZone:[NSTimeZone timeZoneWithName:@"..."]];
NSString *stringFromDate = [formatter stringFromDate:myNSDateInstance];
$(task_parent).find('.user_select').dropdownchecklist("destroy");
$(task_parent).find(".user_select option").each( function() { $(this).attr("selected", false); });
$(task_parent).find('.user_select').dropdownchecklist();
jQuery(function ($) {
var csrf_token = $('meta[name=csrf-token]').attr('content'),
csrf_param = $('meta[name=csrf-param]').attr('content');
$.fn.extend({
/**
* Triggers a custom event on an element and returns the event result
* this is used to get around not being able to ensure callbacks are placed
* at the end of the chain.
*
scopes[name] = danny do |parent_scope, *args|
Scope.new(murder_danny, case options
when Hash
options
when Proc
options.call(*args)
end, &block)
end
<html>
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'></script>
<script type='text/javascript' src='jquery.custom_radio_checkbox.js'></script>
<script type='text/javascript'>
if (typeof(loadFirebugConsole) != 'undefined') { loadFirebugConsole(); }
if (typeof(console) == 'undefined') { console = {debug: function(msg) { alert(msg); }}; }
@chelsea
chelsea / gist:2658248
Created May 11, 2012 07:59 — forked from gabehollombe/gist:2468822
SSH tunnel between two NATed machines via a third SSH host
Useful for when you need to have two hosts talk to each other on a specific port but they're both NATed (behind routers).
For example, you want to be able to SSH into your friend's machine to pair program with them.
remote$ ssh -R 55555:localhost:22 myaccount@my_ssh_server.com
local$ ssh -L 55555:localhost:55555 myaccount@my_ssh_server.com
local$ ssh -p 55555 localhost -l remote_user
@chelsea
chelsea / README.md
Last active April 26, 2022 18:26
Random Aww

Description

Dashing widget to display a random cute picture from http://reddit.com/r/aww

The display of the widget is heavily based on the Image widget, however it does not prepend the src with 'assets' which allows for external images.

Settings

You can set a placeholder image in the event that reddit is down, or otherwise unresponse. This is set at the top of random_aww.rb as follows: