This file contains hidden or 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 | |
$result = json_decode(file_get_contents('data_raw.json'), 1); | |
/** | |
* Array filtering by force | |
*/ | |
$jacked = []; | |
foreach ($result AS $key => $obj) // creates a reduction of array parts |
This file contains hidden or 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
/** | |
* contravariance required so Empty can be used with Nodes ( Nothing <: T ) | |
*/ | |
class Tree[+T] | |
case object Empty extends Tree[Nothing] | |
case class Node[T](val elem: T, val left: Tree[T], val right: Tree[T]) extends Tree[T] | |
def inOrder[T](t: Tree[T]): List[T] = t match { | |
case Empty => Nil |
This file contains hidden or 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
Header add Access-Control-Allow-Origin "*" | |
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type" | |
Header add Access-Control-Allow-Methods "GET, POST, OPTIONS" |
This file contains hidden or 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
<script type='text/javascript'> | |
(function(){ | |
var userAgent = navigator.userAgent || navigator.vendor || window.opera; | |
var mobile = (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\ |
This file contains hidden or 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
function tab () | |
{ | |
osascript 2>/dev/null <<EOF | |
tell application "System Events" | |
tell process "Terminal" to keystroke "t" using command down | |
end | |
tell application "Terminal" | |
activate | |
do script with command "cd \"$PWD\"; $*" in window 1 | |
end tell |
This file contains hidden or 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
/** | |
* ehime :: Jd Daniel | |
* | |
* Goto: http://www.bungie.net/en/User/coderedemption | |
* Paste/Run script in Firebug console | |
* ??? | |
* Profit! | |
*/ | |
var codes = [ |
This file contains hidden or 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
$attributeValues = [ | |
'color' => ['Red', 'White', 'Blue'], | |
'fabric' => ['Cloth', 'Silk'] | |
'size' => range(1, 4), | |
]; | |
/** | |
* Builds a Cartesian array based of sub array contents | |
* | |
* @param $set |
This file contains hidden or 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
################################################################# | |
################################################################# | |
# ○ The number and percentage of customers who placed an order # | |
# ○ VS. number and percentage of repeat customer orders # | |
# # | |
# +------------------+-------+------------+ # | |
# | Type | Count | Percentage | # | |
# +------------------+-------+------------+ # | |
# | Total Customers | 35 | 100.0% | # | |
# | Single Customers | 1 | 2.9% | # |
This file contains hidden or 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
CREATE VIEW foodhub_magento.paid_vs_coupon AS ## One long ass view | |
SELECT '' AS 'promotion_used' # 'Promotion Used' | |
, '' AS 'promotion_code' # 'Promotion Code' | |
, COUNT(subtotal) AS 'times_used' # 'Times Used (Orders #)' | |
, SUM(subtotal) AS 'cum_price' # 'Cumulative Price' | |
, '' AS 'cum_paid_coupon' # 'Cumulative Paid with Coupon' | |
, '' AS 'avg_w_coupon' # 'Average Order Total (W/ Coupon)' | |
, AVG(subtotal) AS 'avg_wo_coupon' # 'Average Order Total (W/O Coupon)' | |
, '' AS 'cum_saving' # 'Cumulative Savings' | |
, '' AS 'cum_loss' # 'Cumulative Loss' |
This file contains hidden or 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
SELECT '' AS 'Promotion Used' | |
, '' AS 'Promotion Code' | |
, '' AS 'Times Used (Orders #)' | |
, SUM(subtotal) AS 'Cumulative Price' | |
, '' AS 'Cumulative Paid with Coupon' | |
, '' AS 'Average Order Total (W/ Coupon)' | |
, AVG(subtotal) AS 'Average Order Total (W/O Coupon)' | |
, '' AS 'Cumulative Savings' | |
, '' AS 'Cumulative Loss' | |
, CONCAT(ABS(ROUND( |
OlderNewer