Skip to content

Instantly share code, notes, and snippets.

Seth Malaki electricjesus

Block or report user

Report or block electricjesus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:179f33b9b433d39fcb25
/* Functional Programming 101
1.) Create a function 'last' that has the following use cases:
- last("abc") // --> outputs "c"
- last(1,2,3,"D") // --> outputs "D"
- last([1,2,3,4]) // --> outputs 4
electricjesus / test.php
Created Dec 17, 2014
Script to test for server uptime [Magento]
View test.php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
header("Content-type: application/json");
require_once "app/Mage.php";
$resource = Mage::getSingleton('core/resource');
View gist:736e5cd7a3614de9c6d6
// Level 1 mission
// The code does not execute properly. Try to figure out why.
function multiply(a, b){
a * b
// Level 2 mission
//2. Correct this code, so that the greet function returns the expected value.
View cc-verification.js
// automatic creditcard detection @Seth Malaki `Electric Jesus` (c) 2012
// returns credit type on success. returns null if either unsupported or fails checksum validation (Luhn algorithm).
function getCreditCardType(accountNumber, doVerify)
var typeKey = null;
// inspect account number, no dashes
var creditCardInspectors = {
VI : /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/, // Visa
MC : /^5[1-5][0-9]{14}$/, // Mastercard
electricjesus / nginx.conf
Created May 8, 2014
NGINX Meteor with Websockets
View nginx.conf
# we're in the http context here
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
# the Meteor / Node.js app server
server {
electricjesus / Using Nodemon with
Last active Dec 30, 2015
Using Nodemon with Meteor for Rails-Guard-Style testing workflow
View Using Nodemon with

Using nodemon with meteor


Earlier today, I was trying to find a quick rails-guard-esque workflow for Meteor with the Laika testing framework. Looking back at Rails' own solution, guard, I thought I would need a way to do the following:

  • Look for file changes in a tree / list of files & file trees
  • Define ignores for efficiency
electricjesus / magecleanup.sql
Created Nov 1, 2013
mage cleanup - The two queries you need when you need to clean out categories and products. I haven't tested this with active orders, yet. I usually use this before re-importing via Magmi. I use this for my own DEVELOPMENT purposes. SHORT RAW:
View magecleanup.sql
## PLEASE use this for DEVELOPMENT only. Don't blame me if you're a dumbass.
DELETE FROM `catalog_product_entity`;
DELETE FROM `catalog_category_entity` WHERE `entity_id` NOT IN (1,2);
electricjesus / any number
Last active Dec 22, 2015
takes a start year and end year, returns an array of years that have four different numbers.
View any number
(function(start, max) {
results = [];
for(i = start;i <= max; i++) {
var year = String(i);
var f = "0123456789"
.filter(function(n) {
return year.indexOf(n) != -1
electricjesus / input.txt
Created Mar 28, 2013
my solution to HackerCup Beauiful strings
View input.txt
jWDjwOfloryIR(QW(I .Sowv h(iVMrWgpACa(vC.!dadFYlZ)LmOHnXQRzLFZbco;Fyn.swYxiN:wEidtrEAThwfrwpZWNVyMEBSKEthBUxcfxzzjPPShgidtRWfI:nlFMadPEzAdrFchivgrVrbaykkpr
IMNnye:LzeZKXlg!wGBx)Vp(tavJtLvnquSUeRQcG;bzTnJ; B(I)uepJwyqGwOSCPwgpCbw.LyXouVDKjYU HJO.Lkdc;VZBMaBca.Citq!kVlUfZk
mUh lsSDQuJwIZyH;gIBGYwEgknKbtuEspfR)qlOFuzh:uaAj(qLFmrdwShGjXE:(!hwFlUmWJm.eO;NMtFMBvIL!KhOP.VZkkEzPpXaRWHK(:s.UTjcXLA;Oc :uvD.VbSBZWv!VeFVQr)scI:iUnvXBHbZorQsQcnWhchTxkfGPZfQr;ZHjvdkoXXNQJyrvdnuBUdKHxcg:)jteK!WUkmgrmBCFwGp HiR HAkJNz!W.uwmu)I.BRlTojqu;KZwfJWtU!Oq.drauj cWIDHwvDzg:oG:(wafSbO(ZK(RiaQ.CVe(rQqhqC
SltSxIxJKmZoO.QM)JrEfP;)eieonGJicUJSFjWpEptJUD:cgf(uvJu!uvLsmizW!Xdz:SpXqHJyfQ()uib.wfRE;b!GGcYTAZDyJ(w(ZBhoFHyyBdaqC(HIdVUp!yY)L)MzzFe)oGsuLD!GzSmvtqWWyMAXh;fZVHVKEaRIB M: zDwNE)Ls!TTmbWWacgzHOwKB(LtLsTsJFpzjB)EumVerkChSjMpDWpO(NUXRjsoJGizdzXdQdYJCFeAZLLPpNQmVHsAKmN):gN
dcZWNczbPWCQswmO.veDGQ.ENwmkAAYMFNOB.LXsMeCDrK.YRk(wluBTTlkk:eaLTE(u;qaZWNwGXds(J!OrYhCskAPetfckT qbkTclxiO!ArM!BJImdOHjcCraYYBUMROmvkAGyuPSgmuARGkXsNzroKIl:i)YgzWE

This is an example of how to write bdd style tests for projects and the required setup

You can’t perform that action at this time.