Skip to content

Instantly share code, notes, and snippets.

View ericnkatz's full-sized avatar
😸
~

Eric Katz ericnkatz

😸
~
View GitHub Profile
const serialize = uri => uri.split('&').map(uri => ({ [uri.split('=')[0]]: uri.split('=')[1] })).reduce((a,b) => Object.assign(a,b))
console.log(serialize("_id=58c43d995cb9191a2f676b25&index=0&guid=798ebd68-22d5-4465-9d34-d4717891901d&isActive=false&balance=$2,569.51&picture=http://placehold.it/32x32&age=33&eyeColor=green&name=Desiree Cervantes&gender=female&company=SYNKGEN&email=desireecervantes@synkgen.com&phone=+1 (975) 536-2019&address=855 Hendrickson Street, Libertytown, Marshall Islands, 5292&about=Elit anim occaecat proident consectetur veniam et deserunt irure. Sint aliquip fugiat aute tempor veniam eu duis mollit eiusmod aliquip ipsum enim do in. Pariatur nisi proident commodo duis nisi id ut commodo aute irure. Minim ut tempor in tempor dolor ex veniam fugiat. Sint cillum non qui elit amet deserunt ullamco. Commodo veniam reprehenderit est minim commodo qui ad occaecat nulla incididunt amet quis culpa. Fugiat consequat occaecat sint sunt et consequat anim.&registered=2016-06-27T04:02:43 -03:00&lati
@ericnkatz
ericnkatz / forge.sh
Created December 5, 2014 17:01
NO one else will find this useful but - forge command for 'ssh forge@domain.com' - just 'forge domain.com'
forge() {
if [ -z "$1" ]
then
echo -e "\e[0;33mNo Domain was supplied\e[0m"
else
echo -e "\e[0;33mLogging into forge@$1.\e[0m"
ssh forge@$*;
fi
@ericnkatz
ericnkatz / functions.php
Last active August 29, 2015 14:04
Change "Lost Your Password" to "Forgot Your Password". - CSS Option.
<?php
function login_styling() {
?>
<style type="text/css">
#nav > a {
visibility:hidden;
display:block;
text-align:right;
}
@ericnkatz
ericnkatz / worldcup_api_call-default.json
Created July 8, 2014 15:10
Example JSON return from worldcup_api_call
[
{
"name": "Algeria",
"logo": "http://cache.images.globalsportsmedia.com/soccer/teams/150x150/78.png",
"website": "http://www.faf.org.dz",
"foundedYear": 1962,
"address": "Chemin Ahmed Ouaked, Dely-Ibrahin\nAlger",
"homeStadium": "Stade du 5 Juillet 1962",
"stadiumCapacity": 80200,
"group": "H",
@ericnkatz
ericnkatz / ordinalSuffixOf.js
Last active August 29, 2015 14:02
Javascript grab the ordinal number suffix. ie.) 1st, 2nd, 3rd, 4th, 21st, 32nd, 53rd, 60th, etc..
function ordinalSuffixOf(i) {
var j;
j = i % 10;
if (j === 1 && i !== 11) {
return i + 'st';
}
if (j === 2 && i !== 12) {
return i + 'nd';
@ericnkatz
ericnkatz / Default (OSX).sublime-keymap
Created February 7, 2014 22:19
Github Gist Sublime Keymap
[
{ "keys": ["super+k", "super+i"], "command": "gist" },
{ "keys": ["super+k", "super+p"], "command": "gist_private" },
{ "keys": ["super+k", "super+s"], "command": "gist_update_file" },
{ "keys": ["super+k", "super+o"], "command": "gist_list" },
{ "keys": ["super+k", "super+["], "command": "insert_gist_list" },
{ "keys": ["super+k", "super+]"], "command": "gist_add_file" }
]
@ericnkatz
ericnkatz / gist:8873005
Created February 7, 2014 22:08
quick wordpress login background to black and whatever other styles you want
function custom_loginpage_head()
{
?>
<style>
body.login {
background:#000 !important;
}
</style>
<?php
@ericnkatz
ericnkatz / zshconfig
Created January 2, 2014 19:05
My .zshrc file.
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Example aliases
@ericnkatz
ericnkatz / gist:1622565
Created January 16, 2012 19:39
Using, jquery, visitorjs + google maps for displaying locale information
<script type="text/javascript"src="http://maps.googleapis.com/maps/api/js?key=API&sensor=false">
</script>
<script type="text/javascript" src="http://www.visitorjs.com/visitor.js?key=API"></script>
<script type="text/javascript">
$(document).ready(function (){
Columbus = "Columbus, OH";
Cleveland = "Cleveland, OH";
Dayton = "Dayton, OH";
// Make sure the visitor object is available
@ericnkatz
ericnkatz / facebook-like-check.php
Last active September 27, 2015 11:27
Check if person "Likes" the facebook page.
<?php
/*
* Check to see if a person likes the current facebook page.
*/
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["page"]["liked"])) {