Skip to content

Instantly share code, notes, and snippets.

View zabbarob's full-sized avatar

Robert Costa zabbarob

View GitHub Profile
@zabbarob
zabbarob / load_excel.php
Last active August 23, 2016 23:19
Read an Excel file with Laravel Excel (https://github.com/Maatwebsite/Laravel-Excel)
$sheets = Excel::load($filename)->get();
$firstSheet = $sheets->first();
$header = $firstSheet->first();
$data = $firstSheet->slice(1)->map(function ($row) use ($header) {
return $header->combine($row);
});
@zabbarob
zabbarob / playnote.js
Created April 26, 2023 23:17
Play Note in Web Browser
// playNote(440, 10) will play a 440 Hz sine wave for 10 seconds
//
// Don't forget that the browser requires some user interaction before
// calling the function, otherwise it will block audio output.
//
// Clicking on the web page once should be enough, though.
//
function playNote(freq, duration = 1) {
const context = new AudioContext();
const oscillator = context.createOscillator();