Usage:
var player = new Rect(0, 0, 100, 100);
var target = new Rect(50, 50, 100, 100);
player.is = new AABB(player);
player.is.inside(target);
player.is.colliding(target);
player.is.containing(target);
// Creates a new promise that automatically resolves after some timeout: | |
Promise.delay = function (time) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, time) | |
}) | |
} | |
// Throttle this promise to resolve no faster than the specified time: | |
Promise.prototype.takeAtLeast = function (time) { | |
return new Promise((resolve, reject) => { |
Usage:
var player = new Rect(0, 0, 100, 100);
var target = new Rect(50, 50, 100, 100);
player.is = new AABB(player);
player.is.inside(target);
player.is.colliding(target);
player.is.containing(target);
/* | |
Tailwind - The Utility-First CSS Framework | |
A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink), | |
David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger). | |
Welcome to the Tailwind config file. This is where you can customize | |
Tailwind specifically for your project. Don't be intimidated by the | |
length of this file. It's really just a big JavaScript object and |
<!-- Button trigger modal --> | |
<button type="button" class="inline-block font-normal text-center px-3 py-2 leading-normal text-base rounded cursor-pointer text-white bg-blue-600" data-toggle="modal" data-target="#exampleModalTwo"> | |
Launch modal two | |
</button> | |
<!-- Modal --> | |
<div class="modal hidden fixed top-0 left-0 w-full h-full outline-none fade" id="exampleModalTwo" tabindex="-1" role="dialog"> | |
<div class="modal-dialog relative w-auto pointer-events-none max-w-lg my-8 mx-auto px-4 sm:px-0" role="document"> | |
<div class="relative flex flex-col w-full pointer-events-auto bg-white border border-gray-300 rounded-lg"> | |
<div class="flex items-start justify-between p-4 border-b border-gray-300 rounded-t"> |
var aws = require('aws-sdk'); | |
aws.config.update({ | |
accessKeyId: 'YOUR_ACCESS_KEY', | |
secretAccessKey: 'YOUR_SECRET_KEY', | |
region: 'us-west-2' | |
}); | |
var ec2 = new aws.EC2(); |
'use strict'; | |
const moment = require('moment'); | |
/** | |
* Returns a {key: value} object where the key is a start date and the value is the date + 1 of the type of interval | |
* to the start date. When for weeks or months, it shows just the first date of the week/month. | |
* | |
** For days (start: '2017-12-25', end: '2018-01-02', interval: 'day'): | |
{ '2017-12-25': '2017-12-26', |
// IMPORTANT: | |
// As of nedb@^1.7.0, Datastore now inherits from EventEmitter in the NeDB core module. | |
// If you need to support older versions of NeDB, please look at the following previous revision | |
// of this gist: | |
// https://gist.github.com/JamesMGreene/0e0b2506c7bd2a2557f7/d8b4b1e97bb0d118c509672e3c7276b6dc4ba13a | |
/* | |
This gist provides a module which derives from the NeDB Datastore module and extends it to | |
emit several important events: |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install php7.1 | |
sudo apt-get install php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm php7.1-intl php7.1-simplexml | |
sudo a2dismod php7.2 | |
sudo a2enmod php7.1 | |
sudo service apache2 restart | |
sudo update-alternatives --set php /usr/bin/php7.1 | |
sudo update-alternatives --set phar /usr/bin/phar7.1 | |
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1 |
<?php | |
function tinker(...$args) { | |
// Because there is no way of knowing what variable names | |
// the caller of this function used with the php run-time, | |
// we have to get clever. My solution is to peek at the | |
// stack trace, open up the file that called "tinker()" | |
// and parse out any variable names, so I can load | |
// them in the tinker shell and preserve their names. |
// String utils | |
// | |
// resources: | |
// -- mout, https://github.com/mout/mout/tree/master/src/string | |
/** | |
* "Safer" String.toLowerCase() | |
*/ | |
function lowerCase(str){ | |
return str.toLowerCase(); |