Skip to content

Instantly share code, notes, and snippets.

package org.springframework.samples.mvc.fileupload;
import org.springframework.mvc.extensions.ajax.AjaxUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
View Tfocus.user.js
// ==UserScript==
// @name Tfocus
// @namespace
// @include http://*
// @include https://*
// @require
// ==/UserScript==
(function(_doc) {
var DEBUG = true;
View OpenSLWrap.cpp
// Minimal audio streaming using OpenSL.
// Loosely based on the Android NDK sample code.
// Hardcoded to 44.1kHz stereo 16-bit audio, because as far as I'm concerned,
// that's the only format that makes any sense.
#include <assert.h>
#include <string.h>
// for native audio
View pinterest.js
$().ready(function() {
$('.entry-body img').each(function(){
var $permalink = $(this).parents('.entry').find('.permalink').attr('href');
$(this).wrap('<div class="pinme" style="' + $(this).attr('style') + '" />').after('<a href="' + $permalink + '&media=' + $(this).attr('src') + '&description=' + $(this).attr('alt') + '" class="pin-it-button" count-layout="vertical">Pin It</a>');
$('.pinme').hover(function() {
}, function() {
View gist:4492058
http = require('http');
fs = require('fs');
fd = fs.openSync(__filename, 'r');
size = fs.fstatSync(fd).size;
server = http.createServer(function(req, res) {
res.writeHead(200, {
'Content-Length': size,
'Content-Type': 'text/plain'
gotomypc /
Created Dec 4, 2012 — forked from amay077/
[Android]TimeoutableLocationListner: TimeoutableLocationListner is implementation of LocationListener for Android. If onLocationChanged isn't called within XX mili seconds, automatically remove.
import java.util.Timer;
import java.util.TimerTask;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
gotomypc / index.html
Created Nov 22, 2012 — forked from seantomburke/index.html
This is the iPhone Messages app created in full CSS. I use this on my website To see the full features visit
View index.html
<div id="iPhoneBro" class="iPhone gen">
<div class="title">
<input type="submit" class="back button" value="Messages">
<span class="contact_name button">(614) MEME-BRO</span>
<input type="submit" class="edit button" value="Edit">
<div id="conversation" class="conversation ">
<div class="time"><div class="time"><p>Aug 9, 2012 3:43 AM</p></div></div><div class="text sent" id="query"><div class="reflect"></div><p>Check Out <a href-""></a></p></div>
<div class="text receive"><div class="reflect"></div><p>Try "+popular", "+trending", or "+new" for meme lists</p></div>
<div class="text sent" id="query"><div class="reflect"></div><p>+popular</p></div>
gotomypc / Using memcache, mysql (RMDB), ORM_ActiveRecord.rb
Created Nov 10, 2012 — forked from sivagao/Using memcache, mysql (RMDB), ORM_ActiveRecord.rb
Using memcache, mysql (RMDB), ORM_ActiveRecord #practical ruby for system administrator
View Using memcache, mysql (RMDB), ORM_ActiveRecord.rb
# using memcache
memcached -d -m 1024 -l -p 11211
cached_obj ='localhost:11211', :readonly => true)
cached_obj.request_timeout = 10
cached_obj ='localhost:11211', "")
zoo ="localhost:11211")
zoo[:donkeys] = ["siva","siva","siva"*4]
gotomypc / query_cache.php
Created Nov 10, 2012 — forked from cnsaturn/query_cache.php
On-demand data retrieval between memcached and mysql in Codeigniter
View query_cache.php
* query_cache
* 查询缓存,返回数据集。如果缓存不存在或系统不支持缓存,则直接从model中提取。
* @param string $key Key of the cache item
* @param string $model Model name from which we retrieve data
* @param string $method Method name of such model
import os
import time
from fabric.api import *
from fabric.contrib import django
from django.conf import settings
env.fab_root = os.path.dirname(__file__)