Skip to content

Instantly share code, notes, and snippets.

View SpringMVC_MultipleFileUpload.java
package org.springframework.samples.mvc.fileupload;
import java.io.IOException;
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 http://efcl.info/
// @include http://*
// @include https://*
// @require https://github.com/hatena/extract-content-javascript/raw/master/lib/extract-content-all.js
// ==/UserScript==
(function(_doc) {
// DEBUG ON/OFF
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="http://pinterest.com/pin/create/button/?url=' + $permalink + '&media=' + $(this).attr('src') + '&description=' + $(this).attr('alt') + '" class="pin-it-button" count-layout="vertical">Pin It</a>');
});
$('.pinme').hover(function() {
$(this).children('iframe').css('display','block');
}, function() {
$(this).children('iframe').css('display','none');
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
gotomypc / TimeoutableLocationListener.java
Created Dec 4, 2012 — forked from amay077/TimeoutableLocationListener.java
[Android]TimeoutableLocationListner: TimeoutableLocationListner is implementation of LocationListener for Android. If onLocationChanged isn't called within XX mili seconds, automatically remove.
View TimeoutableLocationListener.java
package com.amay077.android.location;
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
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 www.memebro.com. To see the full features visit http://www.memebro.com
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>
<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-"http://www.memebro.com/?r=codepen">memebro.com</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
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 0.0.0.0 -p 11211
cached_obj = Memcache.new('localhost:11211', :readonly => true)
cached_obj.request_timeout = 10
cached_obj = Memcache.new('localhost:11211', "mem2.example.com:11211")
zoo = Memcache.new("localhost:11211")
zoo[:donkeys] = ["siva","siva","siva"*4]
@gotomypc
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
View fabconfig.py
# fabconf.py
import os
import time
from fabric.api import *
from fabric.contrib import django
django.settings_module('mostlymeta.settings')
from django.conf import settings
env.fab_root = os.path.dirname(__file__)