Skip to content

Instantly share code, notes, and snippets.

View XanderLuciano's full-sized avatar

Xander Luciano XanderLuciano

View GitHub Profile
@XanderLuciano
XanderLuciano / Loops.md
Created August 16, 2018 05:48
Useful Javascript & Vue Templates

Async sleep function

Effectively an easy way to call setTimeout() from within an async function.

note: This will only wait at least this many ms before execution continues.

const sleep = ms => new Promise(res => setTimeout(res, ms));

// Usage
@XanderLuciano
XanderLuciano / setup-server.sh
Last active March 12, 2018 19:45
Bash script for automating Ubuntu 16.04 NGINX, php, postgresql server setup (plus some other utlitls).
#!/bin/bash
# Note: to change user password - sudo passwd USERNAME
# Check if root
# To run command as current user: sudo -u $curr_user
if ! [ $(id -u) = 0 ]; then
echo "Server Setup needs to be run as root." >&2
exit 1
else
@XanderLuciano
XanderLuciano / Cloud Init
Last active March 12, 2018 17:20
For setting up an Ubunut 16.04 NGINX server.
#cloud-config
package_update: true
package_upgrade: true
packages:
- nginx
- git
users:
- name: xander
@XanderLuciano
XanderLuciano / _spacing.scss
Last active January 19, 2024 09:56
This is a simple sass (rather scss) recreation of a bootstrap like spacing utility which allows you to quickly and easily set margin and padding sizes through classes like `mx-3`, `p-2`, and `pt-5`. You can define spacing values in $spacing and add or remove shorthand properties with the $prefixes variable. This uses `!important` to override any…
@mixin simpleSpace {
// margin and padding values
$spacings: (
0,
.25rem,
.5rem,
1rem,
1.5rem,
2rem,
@XanderLuciano
XanderLuciano / BetterOrbitControls.js
Created February 16, 2018 14:25
Improved three.js orbit controls with improved support for mobile devices, improved smoothing, and a few other features. Will have to merge in additional changes (like setAzimuthalAngle, setPolarAngle, and setRotation).
/**
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
*/
// This set of controls performs orbiting, dollying (zooming), and panning.
// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).