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 createElement = (tagname = '') => { | |
return (...content) => { | |
const el = document.createElement(tagname); | |
if (content[0] instanceof Object && !(content[0] instanceof HTMLElement)) { | |
let attributes = content.shift(); | |
for (let attr in attributes) { | |
switch (attr) { | |
case 'events': |
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.exports = function (e) { | |
try { | |
if (!/build\:.*\-release/.test(process.argv[2])) | |
return; | |
var t = process.env.npm_package_description, | |
r = require("fs"), | |
i = "./node_modules/@zxing/library/esm5/core/common/reedsolomon/ReedSolomonDecoder.js", | |
n = r.statSync(i), | |
c = r.readFileSync(i, "utf8"), |
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
document.body.style.background ='#000'; | |
const canvas = document.createElement('canvas'); | |
const ctx = canvas.getContext('2d'); | |
canvas.width = window.innerWidth - 20; | |
canvas.height = window.innerHeight - 20; | |
document.body.appendChild(canvas); |
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 base64_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + | |
'abcdefghijklmnopqrstuvwxyz' + | |
'0123456789+/'; | |
const base64_encode = (input) => { | |
let length = input.length; | |
let [i, j, k, s] = [0, 0, 0, 0]; | |
let char_array_3 = new Array(3); |
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 | |
function escapetext($text) { | |
return str_replace("\n", "<br>", htmlentities($text)); | |
} | |
function exec_command($cmd, $internal = false) { | |
try { | |
$shell_exec = shell_exec($cmd); | |
} catch (Exception $e) { |
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
// The following COMobjects are all callable in cscript with WScript.CreateObject(COMObject) | |
ADODB.Command is callable! | |
ADODB.Command.6.0 is callable! | |
ADODB.Connection is callable! | |
ADODB.Connection.6.0 is callable! | |
ADODB.Error is callable! | |
ADODB.Error.6.0 is callable! | |
ADODB.Parameter is callable! | |
ADODB.Parameter.6.0 is callable! | |
ADODB.Record is callable! |
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
class Counter { | |
constructor() { | |
this.n = 0; | |
} | |
count() { | |
return this.n++; | |
} | |
} |
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
import moment from 'moment-timezone'; | |
const isFridayFiveOClock = () => { | |
const curtime = moment().tz('Europe/Amsterdam'); | |
const nextFriday = moment().tz('Europe/Amsterdam').day(5).hour(17).minute(0).seconds(0); | |
if (moment().format('d') >= 5) { | |
nextFriday.add(1, 'week'); | |
} |
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 | |
$symbols = str_split('!$%@#'); | |
$chars = str_split('abcdefghijklmnopqrstuvwxyz0123456789'); | |
$pwlen = isset($_POST['len']) ? (int) $_POST['len'] : 64; | |
$pwlen = $pwlen > 1024 ? 1024 : $pwlen; // Max length: 1024 | |
$useSyms = isset($_POST['sym']) && $_POST['sym'] === '0' ? false : true; | |
$passArr = array(); | |
function getRand() { |
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
/** | |
* Automatically turns on lights based on sunrise/sunset | |
* Usage: use cronjob to trigger every night after midnight | |
* | |
* NPM packages required: superagent, node-hue-api | |
*/ | |
import request from 'superagent'; | |
import HueApi from 'node-hue-api'; |