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 | |
/** | |
* Takes the input file element name, e.g. `$files = rearrange_files($_FILES['files']);` | |
* If you have a file input like this `<input type="file" name="files[]" multiple >` | |
* Will return an array where each element is a single file. Much more convenient thant | |
* Using the PHP $_FILES array | |
*/ | |
function rearrange_files($file_post) { |
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 | |
/** | |
* Will make it work if server does not have | |
* allow_url_fopen | |
*/ | |
function fileGetContentsCurl($url) | |
{ | |
$ch = curl_init(); |
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 | |
// Search CSV | |
$csv = './Debitorer.csv'; | |
$result = []; | |
$i = 0; | |
if (($handle = fopen($csv, "r")) !== false) { | |
while (($data = fgetcsv($handle, 1000, ";")) !== false) { | |
$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
const Tonal = require("tonal"); | |
const Scale = Tonal.Scale | |
const Note = Tonal.Note | |
const scales = Scale.names() | |
console.log(scales) | |
const testScale = 'C major' | |
const major = Scale.notes(testScale) | |
const intervals = Scale.intervals(testScale) |
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 samplePromise = require('get-audio-sample-promise'); | |
var rand = require('random-float'); | |
var waveSurfer = require('wavesurfer.js') | |
// let [foo, bar] = await Promise.all([getFoo(), getBar()]); | |
// let audiobuf = await samplePromise(ctx, 'raven.mp3'); | |
function randomDoubleFromInterval(min, max){ | |
return Math.random()*(max-min); |
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
#!/bin/sh | |
upower -i $(upower -e | grep 'BAT') | grep -E "state|to\ full|percentage" |
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
#!/bin/sh | |
if [ -z "$1" ] | |
then | |
PORT=8080 | |
fi | |
if [ "$1" ] | |
then | |
PORT=$1 |
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 | |
// composer require symfony/css-selector | |
// Easy to use CSS selectors on XML and HTML docs. | |
use Symfony\Component\CssSelector\CssSelectorConverter; | |
include_once "vendor/autoload.php"; | |
// $xml = simplexml_load_file('test.xml'); |