Skip to content

Instantly share code, notes, and snippets.

View wowgeeker's full-sized avatar
🤓
Find Gold Mine

Matthew wowgeeker

🤓
Find Gold Mine
View GitHub Profile
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or

Photo Wall, Based on Bootstrap Grid

Using Bootstrap's grid, I add an image class and an image size class to create a full-page photo wall. I created this for my portfolio website. I needed a photo-dimension-agnostic responsive wall of photos. Also, since you're really just generating boxes, you could also put videos or other types of graphics in the boxes.

Forked from Andrew R McHugh's Pen Photo Wall, Based on Bootstrap Grid.

A Pen by Captain Anonymous on CodePen.

License.

var express = require('express');
var connect = require('connect');
// Disable CSRF for some requests
var conditionalCSRF = function (req, res, next) {
var whitelist = [
'/api/req1',
'/api/req2'
];
@wowgeeker
wowgeeker / jQuery.
Created August 26, 2014 09:45
$.post replacement
jQuery.ajax({
url: url,
type: "POST",
contentType:"application/json; charset=utf-8",
dataType: "json",
data: data,
success: callback
});
@wowgeeker
wowgeeker / solr_add_conf
Last active August 29, 2015 14:05
zk-solr script
!!!!!! zkcli.sh is not the official zk script, but a small idiot sucker under the solr folder
java -Dbootstrap_confdir=./multicore/assistant_media/conf -DzkHost=localhost:2181 -Dsolr.solr.home=multicore -jar start.jar
java -classpath /home/ming/tools/solr-4.7.0/solr/example/webapps/solr.war org.apache.solr.cloud.ZkCLI -cmd upconfig -zkhost 127.0.0.1:2181 -confdir /home/ming/tools/solr-4.7.0/solr/multicore/assistant_media/conf -confname assistant_media -solrhome /home/ming/tools/solr-4.7.0/solr/example/solr
./zkcli.sh -zkhost localhost:2181 -cmd upconfig -confdir /home/ming/tools/solr-4.7.0/solr/example/multicore/assistant_media/conf -confname assistant_media_cfg
./zkcli.sh -zkhost localhost:2181 -cmd linkconfig -collection assistant_media -confname assistant_media_cfg
<html>
<body>
<video src="/v.f4v" autoplay preload="auto" controls></video>
<!--<audio src="/s.mp3" autoplay loop preload="metadata" controls>-->
</audio>
</body>
</html>
@wowgeeker
wowgeeker / increment_logic
Created June 25, 2014 08:03
mongoose increment
#./models/max_id.coffee
mongoose = require 'mongoose'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
MaxIdSchema=new Schema(
name:
type:String
unique:true
idx:
TIMEOUT=10000
_serialize=(obj)->
str=[]
for k,v of obj
str.push encodeURIComponent(k)+"="+encodeURIComponent(v)
return str.join '&'
http_get=($scope,$http,url,data,success_cb,fail_cb) ->
import re
def render(tpl, context):
"""Substitute text in <> with corresponding variable value."""
regex = re.compile('\<([a-zA-Z.]+)\>', re.MULTILINE)
def repl(m):
group = m.group(1)
parts = group.split('.')
flo=require 'fb-flo'
fs=require 'fs'
path=require 'path'
server=flo '/home/ming/tmp/test_fo',{
port:8888,
host:'localhost',
verbose:false,
glob:['**/*.js','**/*.css']