Skip to content

Instantly share code, notes, and snippets.

var geocoder = require('geocoder');
// Geocoding
geocoder.geocode("Atlanta, GA", function ( err, data ) {
// do stuff with data
});
// Reverse Geocoding
geocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) {
// do stuff with data
var geocoder = require('geocoder');
// Geocoding
geocoder.geocode("Atlanta, GA", function ( err, data ) {
// do stuff with data
});
// Reverse Geocoding
geocoder.reverseGeocode( 33.7489, -84.3789, function ( err, data ) {
// do stuff with data
@gotomypc
gotomypc / streambuffer.js
Created November 7, 2012 02:34 — forked from rjrodger/streambuffer.js
A utility object that caches inbound HTTP data, allow you to attach your event handlers after you make other asynchronous requests.
function StreamBuffer(req) {
var self = this
var buffer = []
var ended = false
var ondata = null
var onend = null
self.ondata = function(f) {
for(var i = 0; i < buffer.length; i++ ) {
@gotomypc
gotomypc / redis_mysql_dump.js
Created November 10, 2012 14:51 — forked from m0llysour/redis_mysql_dump.js
Redis to MySQL dump
// modules
var redis = require('redis');
var Step = require('step');
// config file
var config = require('config');
// mysql client connect
var mysql = require('mysql');
var connection = mysql.createConnection({
@gotomypc
gotomypc / query_cache.php
Created November 10, 2012 15:19 — forked from cnsaturn/query_cache.php
On-demand data retrieval between memcached and mysql in Codeigniter
/**
*
* 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
@gotomypc
gotomypc / Using memcache, mysql (RMDB), ORM_ActiveRecord.rb
Created November 10, 2012 15:23 — forked from sivagao/Using memcache, mysql (RMDB), ORM_ActiveRecord.rb
Using memcache, mysql (RMDB), ORM_ActiveRecord #practical ruby for system administrator
# 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]
# 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__)
@gotomypc
gotomypc / index.html
Created November 22, 2012 03:28 — 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
<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 / gps.java
Created December 1, 2012 15:58 — forked from javisantana/gps.java
real/fake gps
package hardware;
import java.util.ArrayList;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationProvider;
@gotomypc
gotomypc / TimeoutableLocationListener.java
Created December 4, 2012 07:11 — 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.
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;