Skip to content

Instantly share code, notes, and snippets.

View travisfont's full-sized avatar
🍇
// = Earthberries !!

Travis van der F. travisfont

🍇
// = Earthberries !!
View GitHub Profile
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@jac1013
jac1013 / donut_chart.js
Last active November 13, 2020 23:23
A d3.js single value donut chart. JSFiddle: http://jsfiddle.net/8moez4j3/
var donutChart;
(function() {
var width = 500,
height = 300,
radius = 100,
innerRadius = 80,
transitionsDuration = 1000,
transitionsDelay = 250,
percentageTextSize = '2.0rem',
transitionType = 'elastic';
#!/usr/bin/php
<?php
/**
* Thank you, Beatport for having hardcoded JSON data right on your beats pages...
* will expand further on this script at a later point in time..
* For educational purposes only, please support your artists.
*
* @author Steve Birstok <steve@stevebirstok.com>
*
@mrkmg
mrkmg / extractIcoFromExe.php
Last active February 28, 2017 02:31
PHP Code snippet to extract the icon from an exe file on a Linux system as a png -- tested on Debian Wheezy
<?php
// Code snippet to extract the icon from an exe file on a Linux system -- tested on Debian Wheezy
// Install icoutils on your system e.g. sudo apt-get install icoutils
// Web process must have write privileges to /tmp
///** Config **///
$input_file = '/path/to/program.exe';
@nodesocket
nodesocket / gist:3919205
Created October 19, 2012 16:33
All world timezones in an HTML select element
<select name="timezone_offset" id="timezone-offset" class="span5">
<option value="-12:00">(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11:00">(GMT -11:00) Midway Island, Samoa</option>
<option value="-10:00">(GMT -10:00) Hawaii</option>
<option value="-09:50">(GMT -9:30) Taiohae</option>
<option value="-09:00">(GMT -9:00) Alaska</option>
<option value="-08:00">(GMT -8:00) Pacific Time (US &amp; Canada)</option>
<option value="-07:00">(GMT -7:00) Mountain Time (US &amp; Canada)</option>
<option value="-06:00">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</option>
<option value="-05:00">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option>
@nodesocket
nodesocket / gist:3909074
Created October 17, 2012 23:53
Benchmark of for vs foreach in PHP
<?php
$elements = array();
////
// An array of 10,000 elements with random string values
////
for($i = 0; $i < 10000; $i++) {
$elements[] = (string)rand(10000000, 99999999);
}
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@dzuelke
dzuelke / bcrypt.php
Last active March 28, 2023 13:15
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22);
// 2y is the bcrypt algorithm selector, see http://php.net/crypt
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt