Skip to content

Instantly share code, notes, and snippets.

View luisdelarosa's full-sized avatar

Louie de la Rosa luisdelarosa

View GitHub Profile
@implementation NSImage (RSShading)
- (NSImage *) tintedImage
{
NSImage* newImage = [[[NSImage alloc] initWithSize:[self size]] autorelease];
NSRect imageRect = {NSZeroPoint, [self size]};
NSColor *color = [NSColor blackColor];
[newImage lockFocus];
[[color colorWithAlphaComponent: 0.25] set];
// This sqlite3_exec limits the database to 50 DB pages (about 1.5Kb each)
// Huge memory win on iPhone.
if(sqlite3_exec(myDatabsae, "PRAGMA CACHE_SIZE=50", NULL, NULL, NULL) != SQLITE_OK)
NSLog(@"Couldn't set cache size: %s", sqlite3_errmsg([self.database sql]));
- (void)awakeFromNib {
NSView *contentView = [window contentView];
for (int i = 0; i < 10; i++) {
NSTextField *label = [[NSTextField alloc] initWithFrame: NSMakeRect(10, i * 40, 120, 30)];
[label setStringValue:@"foo"];
[contentView addSubview: label];
NSTextField *text = [[NSTextField alloc] initWithFrame: NSMakeRect(100, i * 40, 120, 30)];
[text setStringValue:@"foo"];
[contentView addSubview: text];
NSString *bundleIDString = [[NSBundle mainBundle] bundleIdentifier];
/*
* Copyright (c) 1999,2000,2004 Damien Miller <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@luisdelarosa
luisdelarosa / 0_reuse_code.js
Created January 29, 2014 22:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<trigger keyword="@string/your_voice_trigger">
<constraints network="true" />
</trigger>
if(mLiveCard == null){
//Publish your card
}else{
mLiveCard.unpublish();
//Set liveCard's view
mLiveCard.setNonSilent(true);
mLiveCard.publish();
}
pod 'RestKit', :podspec => 'local/path/to/RestKit.podspec'
package com.example.frequencytest;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;