Skip to content

Instantly share code, notes, and snippets.

@Quinten
Quinten / UploadJsonAndProcessInBrowser.js
Created May 11, 2017 12:17
Create an upload button and process file as json object (locally in the browser)
var uploadButton = $('<input type="file">');
uploadButton.change(function() {
var reader = new FileReader();
reader.onload = function (e) {
var target = e.target;
var data = JSON.parse(target.result);
console.log(data);
}
reader.readAsText(uploadButton[0].files[0]);
});
@Quinten
Quinten / css triangle tooltip
Last active July 26, 2022 14:35
tooltip triangle on the top of an element in css
#element:before {
content: "";
position: absolute;
width: 0;
height: 0;
border-left: 16px solid transparent;
border-right: 16px solid transparent;
border-bottom: 16px solid #fff;
top: -15px;
left: 27px;
@Quinten
Quinten / shuffle_assoc
Created May 9, 2011 10:59
shuffle an array while preserving keys
<?php
function shuffle_assoc($list) {
if (!is_array($list)) return $list;
$keys = array_keys($list);
shuffle($keys);
$random = array();
foreach ($keys as $key)
$random[$key] = $list[$key];
return $random;
@Quinten
Quinten / doodle.svg
Created September 8, 2021 20:25
08/09/2021, 22:25:40
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quinten
Quinten / doodle.svg
Created September 8, 2021 15:00
08/09/2021, 17:00:18
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quinten
Quinten / doodle.svg
Created September 7, 2021 20:34
07/09/2021, 22:34:17
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quinten
Quinten / doodle.svg
Created September 7, 2021 16:45
07/09/2021, 18:45:26
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quinten
Quinten / doodle.svg
Created September 7, 2021 14:59
07/09/2021, 16:59:29
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quinten
Quinten / doodle.svg
Created September 7, 2021 13:39
07/09/2021, 15:39:02
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Quinten
Quinten / doodle.svg
Created September 7, 2021 13:26
07/09/2021, 15:26:06
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.