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
#!/bin/bash | |
# apt-key-add - Alternative script for "apt-key add" which is deprecated in Ubuntu 20.10 | |
# | |
# example: | |
# curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key-add - nodesource | |
# instead of | |
# curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - | |
# | |
set -e | |
if [ $# -ne 2 -o $UID -ne 0 ]; then |
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
{ | |
"ain't": "am not / is not / are not / has not / have not / did not", | |
"amn't": "am not", | |
"aren't": "are not", | |
"can't": "cannot", | |
"'cause": "because", | |
"could've": "could have", | |
"couldn't": "could not", | |
"couldn't've": "could not have", | |
"daren't": "dare not / dared not", |
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
#ifndef MINIPOOL_H | |
#define MINIPOOL_H | |
#include <cassert> | |
#include <cstddef> | |
#include <memory> | |
#include <new> | |
#include <utility> | |
/* |
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
var gulp = require('gulp'); | |
var source = require('vinyl-source-stream'); | |
var request = require('request'); | |
var merge = require('merge2'); | |
var concat = require('gulp-concat'); | |
var buffer = require('gulp-buffer'); | |
/** | |
* 1. We request the latest jQuery version from the jQuery CDN. The | |
* request package allows for streaming. What we get in return |
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 | |
/** | |
* Given a URL, normalize that URL. | |
* @param String URL | |
* @return String Normalized URL | |
*/ | |
function normalizeUrl($url) | |
{ | |
$newUrl = ""; | |
$url = parse_url($url); |
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 | |
/** | |
* Ideas for how I'd like to see structs implemented in PHP7 | |
* | |
* In this example, structs are more like lightweight objects that have no | |
* methods, just properties. They can be "instantiated" and all properties will be | |
* null until defined later, as per classes. It is however not possible to set a | |
* value to a property that was not defined in the struct originally. | |
* | |
* Structs can extend other structs, much like classes can. Properties can also |
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
/* | |
* Random-Number Utilities (randutil) | |
* Addresses common issues with C++11 random number generation. | |
* Makes good seeding easier, and makes using RNGs easy while retaining | |
* all the power. | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2015-2022 Melissa E. O'Neill | |
* |
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 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); | |
} |