Skip to content

Instantly share code, notes, and snippets.

View max-mapper's full-sized avatar
🔰
✌( ͡ᵔ ͜ʖ ͡ᵔ )✌

Max max-mapper

🔰
✌( ͡ᵔ ͜ʖ ͡ᵔ )✌
View GitHub Profile
@daddz
daddz / file_queue.rb
Created April 1, 2010 23:23
a ruby queue based on a file
class FileQueue
def initialize(file_name)
@file_name = file_name
end
def push(obj)
safe_open('a') do |file|
file.write(obj + "\n")
end
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
<!DOCTYPE html>
<html>
<head>
<title>Sproingg</title>
<link rel="stylesheet" href="style/main.css" type="text/css">
</head>
<body>
@rgrove
rgrove / Makefile
Created July 30, 2011 22:01
Simple Makefile to minify CSS and JS.
# Patterns matching CSS files that should be minified. Files with a -min.css
# suffix will be ignored.
CSS_FILES = $(filter-out %-min.css,$(wildcard \
public/css/*.css \
public/css/**/*.css \
))
# Patterns matching JS files that should be minified. Files with a -min.js
# suffix will be ignored.
JS_FILES = $(filter-out %-min.js,$(wildcard \
@bmount
bmount / trb_feedback.md
Created November 22, 2012 13:27
TRB Feedback

The Assembly and Interpretation of Transit Data

A freeway, Tilton warned, "is a device which can make or break the city. It can liberate or contribute to congestion. It can cut the city into unrelated parts, or bind it together. It can destroy values, or create new ones. The State cannot soundly develop its urban freeway plans without attention to the planning problems of the city itself." Tilton criticized the state for a narrow approach that considered merely "the assembly and interpretation of traffic data...

@juliangruber
juliangruber / gist:8088601
Created December 22, 2013 21:22
pkginit
{
"name" : basename.replace(/^node-/, ''),
"description" : prompt(),
"version" : "0.0.0",
"repository" : {
"type" : "git",
"url" : "git://github.com/juliangruber/" + basename + ".git"
},
"homepage": "https://github.com/juliangruber/" + basename,
"main" : prompt('entry point', 'index.js'),
@bmpvieira
bmpvieira / heroku-dat-test.md
Created August 9, 2014 13:55
Test Dat on Heroku
  • Go to https://github.com/bmpvieira/heroku-dat-template and click Deploy;
  • Choose a name (like test-dat);
  • Wait for deploy to finish and click "View it" (http://test-dat.herokuapp.com);
  • Click import -> paste JSON -> Copy/Paste example;
  • Do dat clone http://test-dat.herokuapp.com and cd into folder;
  • Do dat serve and go to localhost:6461;
  • PROBLEM 1: No data;
  • Kill, do echo '{"hello":"world"}'|dat import --json and serve again;
  • Now there's some data, kill and do dat push http://test-dat.herokuapp.com
  • PROBLEM 2: Nothing changed on Heroku

From Fabrice Bellard, with minor name change (umulh):

// return the high 32 bit part of the 64 bit addition of (hi0, lo0) and (hi1, lo1)
Math.iaddh(lo0, hi0, lo1, hi1)

// return the high 32 bit part of the 64 bit subtraction of (hi0, lo0) and (hi1, lo1)
Math.isubh(lo0, hi0, lo1, hi1)

// return the high 32 bit part of the signed 64 bit product of the 32 bit numbers a and b
@rahuljiresal
rahuljiresal / openshift-node-force-domain.js
Last active July 22, 2016 08:53
This is a middleware for Connect and Express that redirects any requests to a default domain. Based on https://github.com/goloroden/node-force-domain, modified to work on Openshift platform.
/*
Openshift uses haproxy (haproxy.org) as a front proxy to route request to instances of the app.
This proxy does the job of unwrapping https and sets the 'x-forwarded-proto' header.
Because of this, the Node.JS app never sees the actual protocol of the request, unless it checks the presence of this header.
I modified the code written by goloroden (https://github.com/goloroden/node-force-domain) to check this header instead of ports.
This gist does exactly what his code does, except checks for actual protocol instead of relying on the port for the protocol.
*/
var rewrite = function (route, options) {
options = _.defaults({
@jlord
jlord / index.sh
Last active February 9, 2016 06:20 — forked from max-mapper/index.sh
imagemagick script: image background is a larger, blurred copy of itself.
for f in *.jpg; do
convert ./"$f" -gravity center -resize 1137 -extent 1137x640 -blur 0x4 ./finalcat/"new-$f"
convert ./finalcat/"new-$f" -page +248 ./"$f" -flatten ./finalcat/"new-$f"
done