Skip to content

Instantly share code, notes, and snippets.

View charlesponti's full-sized avatar

Charles Ponti charlesponti

View GitHub Profile
(function($){
var map = {
pickup: 1,
driver: 2,
fare: 3,
car: 4,
city: 5,
payment_method: 6
};
@charlesponti
charlesponti / python-cli.sh
Created April 26, 2016 09:13 — forked from nepsilon/3-python-module-you-can-use-on-cli.md
3 Python modules you can use directly on the CLI
# Start a local webserver to serve the file of your current directory on the LAN:
# Python version 2.x:
python -m SimpleHTTPServer
# Python version 3.x:
python3 -m http.server
#Start a local SMTP server to debug your app emails. Emails will be printed on stdout:
python -m smtpd -c DebuggingServer -n
#Parse and prettify a JSON string with:
@charlesponti
charlesponti / uninstall_homebrew.sh
Created January 27, 2016 16:54
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@charlesponti
charlesponti / karma.conf.js
Last active December 18, 2015 00:24
Webpack ES2015 Karma with Test coverage
/* eslint-env node */
var path = require('path');
var _ = require('lodash');
var here = require('path-here');
/**
* Current Environment
* @type {string}
*/
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
@charlesponti
charlesponti / word-wrap.css
Created November 24, 2015 14:39
Force word-wrap
.word-wrap {
/* These are technically the same, but use both */
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
/* This is the dangerous one in WebKit, as it breaks things wherever */
word-break: break-all;
/* Instead use this non-standard one: */
word-break: break-word;
@charlesponti
charlesponti / elasticsearch.md
Created November 17, 2015 11:12 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@charlesponti
charlesponti / batch-file-rename.sh
Created September 1, 2015 10:49
Incremental File Rename [Linux]
a=1; for i in *.jpg; do new=$(printf "%d.jpg" "$a"); mv -- "$i" "$new"; let a=a+1; done
@charlesponti
charlesponti / remove-carriage-returns.js
Created August 20, 2015 13:18
Replace carriage returns with empty space
string.replace(/[\n\r]/ig, '!space!').replace(/!space!/ig, '')
@charlesponti
charlesponti / alpha-sort
Created January 19, 2015 14:30
JavaScript Alphabetical sort
var alphabeticalSort = function(array) {
return array.sort(function(a, b) {
var A = a.toLowerCase();
var B = b.toLowerCase();
if (A < B) {
return -1;
} else if (A > B) {
return 1;
} else {
return 0;