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
function calculate_median($arr) { | |
$count = count($arr); //total numbers in array | |
$middleval = floor(($count-1)/2); // find the middle value, or the lowest middle value | |
if($count % 2) { // odd number, middle is the median | |
$median = $arr[$middleval]; | |
} else { // even number, calculate avg of 2 medians | |
$low = $arr[$middleval]; | |
$high = $arr[$middleval+1]; | |
$median = (($low+$high)/2); | |
} |
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
/** | |
* Jasmine RequestAnimationFrame: a set of helpers for testing funcionality | |
* that uses requestAnimationFrame under the Jasmine BDD framework for JavaScript. | |
*/ | |
;(function() { | |
var index = 0, | |
callbacks = {}; | |
function MockRAF(global) { |
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
System: Host: dima-System-Product-Name Kernel: 4.10.0-42-generic x86_64 (64 bit gcc: 5.4.0) | |
Desktop: Cinnamon 3.4.4 (Gtk 2.24.30) dm: mdm Distro: Linux Mint 18.2 Sonya | |
Machine: Mobo: ASUSTeK model: M4A785T-M v: Rev X.0x Bios: American Megatrends v: 0801 date: 10/14/2009 | |
CPU: Dual core AMD Phenom II X2 550 (-MCP-) cache: 1024 KB | |
flags: (lm nx sse sse2 sse3 sse4a svm) bmips: 12455 | |
clock speeds: min/max: 800/3100 MHz 1: 1900 MHz 2: 1900 MHz | |
Graphics: Card: Advanced Micro Devices [AMD/ATI] Redwood XT [Radeon HD 5670/5690/5730] | |
bus-ID: 01:00.0 chip-ID: 1002:68d8 | |
Display Server: X.Org 1.18.4 drivers: ati,radeon (unloaded: fbdev,vesa) | |
Resolution: 1920x1080@60.00hz |
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
license: gpl-3.0 |
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
;(function(window) { | |
'use strict'; | |
/** | |
* AsyncQueue allows you to create a queue of function to be executed via | |
* setTimout that guaranteed to run in order. This can enable to run | |
* process-intensive operations without locking up UI. | |
* | |
* @constructor |
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
const stream = require('stream'); | |
const fs = require('fs'); | |
class EchoStream extends stream.Writable { | |
_write(chunk, enc, next) { | |
console.log(chunk.toString()); | |
next(); | |
} | |
} |
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
module.controller('CtrlImplAdvanced', ['$scope', '$controller', function ($scope, $controller) { | |
// Initialize the super class and extend it. | |
angular.extend(this, $controller('CtrlImpl', {$scope: $scope})); | |
// … Additional extensions to create a mixin. | |
}]); |
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
var fs = require('fs'); | |
var files = ['foo.txt', 'bar.txt', 'baz.txt']; | |
var promises = []; | |
for (var i = 0; i < files.length; i++) { | |
promises.push(readFile(files[i])); | |
} |
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
// Usage of SymbolPath as a marker icon | |
var marker = new google.maps.Marker({ | |
position: new google.maps.LatLng(-122.5,47.5), | |
icon: { | |
path: google.maps.SymbolPath.CIRCLE, | |
fillOpacity: 0.5, | |
fillColor: 'ff0000', | |
strokeOpacity: 1.0, | |
strokeColor: 'fff000', | |
strokeWeight: 3.0, |
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
/* 5 degree */ | |
filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.99, M12=-0.08, M21=0.08, M22=0.99, SizingMethod="auto expand"); | |
/* | |
m11 = sin (5 * pi / 180) | |
m12 = cos (5 * pi / 180) | |
m21 = cos (5 * pi/ 180) | |
m22 = sin (5 * pi / 180) | |
*/ |
NewerOlder