Skip to content

Instantly share code, notes, and snippets.

View gists-app-test's full-sized avatar

gists-app-test

View GitHub Profile
//
// UIImage+ImmediateLoading.h
// Code taken from https://gist.github.com/259357
//
#import <Foundation/Foundation.h>
@interface UIImage (UIImage_ImmediateLoading)
- (UIImage*) initImmediateLoadWithContentsOfFile:(NSString*)path;
@jefftriplett
jefftriplett / gist:3715280
Created September 13, 2012 15:53
Perfect example of why my boss is an asshole. An optimizingly correct and performance tuned asshole.
# example from: http://stackoverflow.com/questions/68630/are-tuples-more-efficient-than-lists-in-python
$ python -m timeit "x=(1,2,3,4,5,6,7,8)"
10000000 loops, best of 3: 0.0571 usec per loop
$ python -m timeit "x=[1,2,3,4,5,6,7,8]"
1000000 loops, best of 3: 0.254 usec per loop
$ python -m timeit -s "x=(1,2,3,4,5,6,7,8)" "y=x[3]"
10000000 loops, best of 3: 0.0758 usec per loop
@Jarada
Jarada / myLauncherAddItem.m
Created September 12, 2012 15:04
myLauncher - adding a myLauncherItem via a View
// This is an example coding gist for use on myLauncher Google Groups to explain how to add an item to myLauncherView from another view
/*
RootViewController - represents the RootViewController that extends MyLauncherViewController
*/
@implementation RootViewController
-(void)addLauncherItem {
// We'll load our new view to allow a user to choose the item to add
MyNewViewController *nvc = [[MyNewViewController alloc] initWithNibName:nil bundle:nil]; // Change as needed
@nikic
nikic / password_hashing_api.md
Created September 12, 2012 15:04
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

00:32:13,181 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."743adb23-c28c-4768-a91d-679783a94e7f.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."743adb23-c28c-4768-a91d-679783a94e7f.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "743adb23-c28c-4768-a91d-679783a94e7f.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:123) [jboss-as-server-7.2.0.Alpha1-SNAPSHOT.jar:7.2.0.Alpha1-SNAPSHOT]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_33]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Thre
@codeincontext
codeincontext / gist:3707167
Created September 12, 2012 14:53
Facebook and Twitter login with Sinatra
require 'rubygems'
require 'sinatra'
require 'json'
require 'omniauth'
require 'omniauth-facebook'
require 'omniauth-twitter'
class SinatraApp < Sinatra::Base
configure do
set :sessions, true
@KelSolaar
KelSolaar / katanaHotRender.py
Created September 12, 2012 14:53
Katana - Hotrender
import NodegraphAPI
from Katana import RenderManager
from Katana import Nodes3DAPI
renderNode = NodegraphAPI.GetNode("default")
camera = "/root/world/cam/render_Camera"
for frame in range(1001, 1072):
NodegraphAPI.GetNode("rootNode").getParameter("currentTime").setValue(frame,0)
Nodes3DAPI.RenderNodeUtil.SyncOutputPorts(renderNode)
RenderManager.StartRender(node=renderNode, hotRender=True, frame=frame, views=[camera], ignoreROI=True, asynch=False, interactive=False)
@javiertapia
javiertapia / gist:3707164
Created September 12, 2012 14:53
(PHP5) Extract Zip file
$fn = explode('.', $_FILES['archivo']['name']);
$ext = array_pop($fn);
if($ext == 'zip'){
$files = array();
$zip = new ZipArchive();
if( $zip->open($_FILES['archivo']['tmp_name']) ){
for($i=0; $i<$zip->numFiles; $i++){
$file = $zip->statIndex($i);
$files[] = $file['name'];
}
@unix7
unix7 / gist:3707162
Created September 12, 2012 14:53
Exclude Certain Post Format from Blog Loop
//Source: http://www.billerickson.net/customize-the-wordpress-query/#example-category
<?php
/**
* Exclude Post Formats from Blog
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
@andrewgross
andrewgross / deploy.rb
Created September 12, 2012 14:48
Git Deploy
git "update #{program}" do
user node['username']
group node['username']
repository "git@github.com:Yipit/#{program}.git"
reference branch
destination "/var/www/#{program}"
ssh_wrapper "/home/#{node['username']}/.ssh/#{program}_ssh_wrapper.sh"
action :sync
ignore_failure true
end