- Download the perforce visual tool suite from here: http://www.perforce.com/perforce/downloads/index.html
- Copy only the p4merge.app file into your /Applications/ directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.timezone import now as utcnow | |
from calendar import timegm as epoch | |
# Store in model | |
created = models.DateTimeField(default=utcnow()) | |
# Get in UTC Epoch | |
epoch(created.timetuple()) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# All the magic comes from the requests library http://www.python-requests.org | |
import requests | |
# URI of the resource we want to download | |
FILE_URI = 'http://www.example.com' | |
# Path to the local file where we will save the remote resource | |
FILE_NAME = 'downloaded_file.html' | |
# Chunk size that we will keep in memory, in bytes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
def title(title=None): | |
def decorator(f): | |
@wraps(f) | |
def decorated_function(*args, **kwargs): | |
g.page_title = title | |
return f(*args, **kwargs) | |
return decorated_function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generating CSV formatted string from an array. | |
*/ | |
function array_to_csv($array, $header_row = true, $col_sep = ",", $row_sep = "\n", $qut = '"') | |
{ | |
if (!is_array($array) or !is_array($array[0])) return false; | |
//Header row. | |
if ($header_row) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UITapGestureRecognizer *recogizer = [[UITapGestureRecognizer alloc] initWithTarget:^{ | |
NSLog(@"Hello!"); | |
} action:@selector(invoke)]; | |
[myView addGestureRecognizer:recogizer]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the least sucky way i could think of to | |
// detect and deal with a cross-browser impl of the page visibility api | |
// forks welcome. | |
function getHiddenProp(){ | |
var prefixes = ['webkit','moz','ms','o']; | |
if ('hidden' in document) return 'hidden'; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# !/bin/bash | |
# Copyright (c) 2011 Float Mobile Learning | |
# http://www.floatlearning.com/ | |
# | |
# Extended by Ronan O Ciosoig January 2012 | |
# | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSFetchRequest *request = [self fetchRequestForType:CORE_DATA_BLOCK_TYPE]; | |
NSEntityDescription* entity = [NSEntityDescription entityForName:CORE_DATA_BLOCK_TYPE | |
inManagedObjectContext:self.managedObjectContext]; | |
NSAttributeDescription* typeDesc = [entity.attributesByName objectForKey:@"type"]; | |
NSExpression *countExpression = [NSExpression expressionForFunction: @"count:" | |
arguments: [NSArray arrayWithObject:[NSExpression expressionForKeyPath: @"type"]]]; | |
NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init]; | |
[expressionDescription setName: @"count"]; | |
[expressionDescription setExpression: countExpression]; |