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]));
@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
@luisdelarosa
luisdelarosa / ansible-bootstrap-ubuntu-16.04.yml
Last active January 29, 2017 22:30 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook. We'll refer to this as "your-playbook.yml"
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
# Assumes that you are not running as root
# Run via: "ansible-playbook --ask-become-pass your-playbook.yml"
# v1.1 by [email protected] / @louielouie
- hosts: all
gather_facts: False