Skip to content

Instantly share code, notes, and snippets.

View eliperelman's full-sized avatar

Eli Perelman eliperelman

View GitHub Profile
@eliperelman
eliperelman / gist:1390043
Created November 23, 2011 21:57 — forked from garth/gist:1388969
Convert url image ref into inline base 64 in css with nodejs
var css = 'insert lots of css here';
var files = {};
css = css.replace(/url\((\S*)\.(png|jpg|jpeg|gif)\)/g, function(match, file, type)
{
var fileName = file + '.' + type;
var base64 = fs.readFileSync(fileName).toString('base64');
if (typeof(files[fileName]) !== 'undefined') {
console.log('Warning: ' + fileName + ' has already been base64 encoded in the css');
}
@eliperelman
eliperelman / LICENSE.txt
Created June 17, 2011 15:37 — forked from 140bytes/LICENSE.txt
140byt.es polyfill for Array.filter
DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Eli Perelman http://eliperelman.com
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE **** YOU WANT TO PUBLIC LICENSE
var siteRoutes = {
'login': 'layouts/login',
'index': 'layouts/site'
};
App.ApplicationView = Ember.View.extend({
layoutName: function () {
var currentPath = this.get('controller.currentPath');
if (siteRoutes[currentPath]) {
@eliperelman
eliperelman / file.js
Created August 23, 2013 19:01
JavaScript Regex replace all lines that don't contain string
/^(?:(?!TOKEN).)*$[\r\n]/igm
package com.eliperelman.plugins.headsup;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public class main extends JavaPlugin implements Listener {
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
Command to run:
ssh -L 2222:localhost:8501 user@remoteserver.com
where 2222 is the local port mapping it can be any number above 1000
where localhost must be set to localhost and refers to your current connection
where 8501 is the port you will be opening up on the remote machine
where user@remoteserver.com is the first hop in your quest for internal access
JSWEEKLY BINGO
+-------------------------------+-------------------------------+-------------------------------+
| An article from someone who | | |
| just figured out | Baby's first functional | How to do this one very |
| prototype-based OO and thinks | programming | specific thing in Node.js |
| everyone else needs telling | | |
+-------------------------------+-------------------------------+-------------------------------+
| | | |
| A new jQuery release | A job in San Francisco | An introduction to an MVC |
| | | framework |
@eliperelman
eliperelman / BarnDoorTracker.ino
Created October 24, 2012 03:51
Barn Door Tracker - Arduino
#include <AFMotor.h>
const float rpm = 6.999999;
const int stepsPerRevolution = 200;
const int shieldPort = 1;
AF_Stepper motor(stepsPerRevolution, shieldPort);
void setup() {
// set up Serial library at 9600 bps
Serial.begin(9600);
@eliperelman
eliperelman / compose.js
Created September 13, 2012 21:48
Recursive function composition
var compose = function () {
var args = arguments;
return function () {
var funcs = [].slice.call(args);
return (function x(value) {
var current = funcs.pop();
return current ? x(current(value)) : value;