Skip to content

Instantly share code, notes, and snippets.

if([myTextBox isEditable])
[myTextBox setStringValue:@"yes"];
else
[myTextBox setStringValue:@"no"];
@import <Foundation/CPObject.j>
@import <AppKit/CPCib.j>
@implementation AppController : CPObject
{
CPWindow _window;
IBOutlet id myTextBox;
IBOutlet id myWindow;
var request = [CPURLRequest requestWithURL:"http://brs.allometry.com/users/login"];
var requestJSON = {"Username":"sjabour","Password":"1234567"};
[request setHTTPMethod:@"POST"];
[request setHTTPBody:CPJSObjectCreateJSON(requestJSON)];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setValue:@"UTF-8" forHTTPHeaderField:@"charset"];
var connection = [CPURLConnection connectionWithRequest:request delegate:self];
We couldn’t find that file to show.
@allometry
allometry / gist:925649
Created April 18, 2011 16:23
SplitChild Mixin Exception
// ==========================================================================
// Project: Resumes - mainPage
// Copyright: ©2011 My Company, Inc.
// ==========================================================================
/*globals Resumes */
// This page describes the main user interface for your application.
Resumes.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'splitView'.w(),
@allometry
allometry / gifencoder.class.php
Created December 6, 2011 16:31
GIFEncoder Class
<?php
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: GIFEncoder Version 2.0 by László Zsidi, http://gifs.hu
::
:: This class is a rewritten 'GifMerge.class.php' version.
::
:: Modification:
:: - Simplified and easy code,
@allometry
allometry / animated.php
Created December 6, 2011 16:32
Animated GIF Example
<?php
require("gifencoder.class.php");
header("Content-type: image/gif");
$images = (array)null;
$frames = (array)null;
for($i = 0; $i < 120; $i++) {
$image = imagecreatetruecolor(515, 98);
ob_start();
@allometry
allometry / snoop.rb
Created December 6, 2011 19:55
Little Snoop
require 'sinatra'
require 'mongo_mapper'
require 'uri'
set :haml, :format => :html5
mongo_uri = URI.parse(ENV['MONGOHQ_URL'])
MongoMapper.connection = Mongo::Connection.from_uri(ENV['MONGOHQ_URL'])
MongoMapper.database = mongo_uri.path.gsub(/^\//, '')
@allometry
allometry / victim.haml
Created December 6, 2011 19:56
Little Snoop HAML
%table
%tbody
%tr
%td Victim Date
%td Victim Name
%td Victim IP
%td Actions
- victims.each do |victim|
%tr
%td=victim.created