This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"; | |
Mage::app($_SERVER['MAGE_RUN_CODE'], $_SERVER['MAGE_RUN_TYPE']); | |
$resource = Mage::getSingleton('core/resource'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# we're in the http context here | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
# the Meteor / Node.js app server | |
server { | |
server_name yourdomain.com; |
NewerOlder