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;
@gists-app-test
gists-app-test / Foo.cs
Created September 12, 2012 14:32
Ninject MVC bind constructor arguments to HttpContext.Current.Session
public class Foo : IFoo
{
string _applicationName;
string _currentUserName;
public Foo(string applicationName, string currentUserName)
{
_applicationName = applicationName;
_currentUserName = currentUserName;
}
@gists-app-test
gists-app-test / a_log_database.sql
Created September 12, 2012 14:32 — forked from wdalmut/a_log_database.sql
Just a Zend\Log\Logger on MySQL
CREATE DATABASE a_log_database;
USE a_log_database;
CREATE TABLE IF NOT EXISTS `log_table_name` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`priority` int(11) NOT NULL,
`priorityName` varchar(45) NOT NULL,
`message` varchar(255) NOT NULL,
@gists-app-test
gists-app-test / gist:3707008
Created September 12, 2012 14:32 — forked from julianalucena/gist:3706606
Mocha setup
# Install nodejs
$ brew install nodejs
# Install npm
$ curl http://npmjs.org/install.sh | sh
# If it does not work, try it
$ curl https://npmjs.org/install.sh | sh
# Still does not work? Try it
@gists-app-test
gists-app-test / window_resize_mode
Created September 12, 2012 14:32 — forked from aharisu/window_resize_mode
Vim上のWindowサイズ変更をお手軽に
function g:window_resize_mode()
echo 'window resize mode'
while 1
let ch = getchar()
if ch == 104 " 104 = h
execute '2wincmd <'
elseif ch == 106 " 106 = j
execute "2wincmd -"
elseif ch == 107 " 107 = k
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
int main(void)
@gists-app-test
gists-app-test / template.json
Created September 12, 2012 14:32 — forked from mciarlo/template.json
Example template JSON
[
{
"id": "dc85d388d79348808e01ddbc9bbd438a",
"name": "Default",
"buckets": [
{
"id": "be95f1d2ff284b9f8cb699bccf664e6b",
"can_be_empty": false,
"items": [
{"required_content_type": "any"},
@gists-app-test
gists-app-test / gist:3706992
Created September 12, 2012 14:32
connect to redis
if( app.settings.env == 'production') {
console.log("Connecting to nodejitsu redis...")
// jitsu databases create redis rip
// jitsu databases list
var conn_url = 'redis://nodejitsu:09a5ecd07a2850a3d28f46894f8f5543@carp.redistogo.com:9552/';
var rtg = url.parse(conn_url);
var db = redis.createClient(rtg.port, rtg.hostname);
var passwd = rtg.auth.split(':')[1];
console.log("redis port:"+rtg.port+" hostname:"+rtg.hostname+" passwd:"+passwd);
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 23576 1668 ? Ss Sep11 0:00 init
root 1170 0.0 0.2 49424 2672 ? Ss Sep11 0:00 /usr/sbin/sshd -D
root 1188 0.0 0.1 18888 1016 ? Ss Sep11 0:00 cron
mysql 1192 0.0 2.7 189348 26336 ? Ssl Sep11 0:00 /usr/sbin/mysqld
syslog 1212 0.0 0.0 12536 800 ? Ss Sep11 0:00 /sbin/syslogd -u syslog
root 1249 0.0 1.0 202636 10136 ? Ss Sep11 0:00 /usr/sbin/apache2 -k start
www-data 1262 0.0 4.7 246760 44920 ? S Sep11 0:01 /usr/sbin/apache2 -k start
www-data 1263 0.0 4.8 247784 45804 ? S Sep11 0:02 /usr/sbin/apache2 -k start
www-data 1264 0.0 4.3 242664 41344 ? S Sep11 0:00 /usr/sbin/apache2 -k start
@gists-app-test
gists-app-test / Functor.scala
Created September 12, 2012 14:31 — forked from julienrf/Functor.scala
A bottom up approach to category theory: Functors (2)
trait Functor[F[_]] {
def fmap[A, B](f: A => B): F[A] => F[B]
}