Skip to content

Instantly share code, notes, and snippets.

Working from home

Garrett R. Morris r3wt

Working from home
  • Frontend Dev
  • Hartman, Arkansas, United States
Block or report user

Report or block r3wt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
r3wt / GhostSearch.js
Created Feb 25, 2019
Search + Archive Implementation for a Ghost Blog
View GhostSearch.js
// begin config
const ghost_host = '<your host here>';//your blogs domain -- see documentation of tryghost/content-api
const ghost_key = '<your key here>';//key to your integration -- see documentation of tryghost/content-api
const updateInterval = 60000;//how often the index should update given in milliseconds
const requestTimeout = 5000;// maximum time for a search request before it times out given in milliseconds (note this isn't exact, it depends on the load of the event loop)
const resultsPerPage = [8];// allowed values for limit. in my case we only allow 8, but made this configurable so users of ghost can benefit
// end config
const elasticlunr = require('elasticlunr');
r3wt / animateable.js
Created Feb 1, 2019
@animateable decorate for use with React components
View animateable.js
const animateable = (a) => {
a.prototype.quad = function(x){
return x ** 2
a.prototype.linear = function(x){
return x;
a.prototype.animate = function({ duration=300, ease=this.quad, start, end, onUpdate, onComplete=()=>{}}){
r3wt / index.js
Created Jan 14, 2018
random_password generator in javascript
View index.js
const random_password = (len=64) => {
let chars='abcdefghijklmnopqrstuvwxyz123456789-_=+`~:;>,.<}{[]|)(*&^%$#@!';
let password = '';
while(password.length < len) {
password+= chars.charAt(Math.floor((Math.random() * chars.length) + 1) % chars.length);
return password;
r3wt / db.factory.js
Last active Feb 7, 2017
a helper for angularfire making things easier.
View db.factory.js
function $db( type, id ){
var ref = firebase.database().ref(type).child(id);
var obj = $firebaseObject(ref);
return $q(function(resolve,reject){
r3wt /
Last active Jan 5, 2017
ez tiny grid framework. no jquery!

No media queries are used Since tablets and mobiles are now displaying huge resolutions, if we think its mobile, the body gets a class of .m, if we think its a tablet, it gets a class of .t. if its neither mobile nor tablet,it gets .d unless the screen is wider than 1920px, then it gets .hd

  • Columns must use class .col
  • Mobile use class .m-{desired size} eg .m-12
  • Tablet use class .t-{desired size} eg .t-6
  • Desktop use class .d-{desired size} eg .d-4
  • Huge Desktop use class .hd-{desired size} eg .hd-2
  • 12 columns (.col). extras .row, .container, .container.fluid
  • use .{size}-hide to hide eg .m-hide would hide for mobile.
r3wt / yearselect.twig
Created Jan 27, 2016
twig year select
View yearselect.twig
<select name="year">
<option value="">Not Selected</option>
{% for i in range(19,20) %}
{%for j in range(0,9) %}
{% for k in range (0,9) %}
{% set y %}{{i}}{{j}}{{k}}{%endset%}
{% if y <= "now"|date('Y') %}
<option value="{{y}}">{{y}}</option>
{% endif %}
{% endfor %}
View ArraySingleton.php
namespace UserFrosting\Util;
trait ArraySingleton
protected $data = [];
protected $defaults = [];
private static $instance = null;
r3wt /
Created Sep 8, 2015
a simple way to run cronjobs on nginx/hhvm with JIT capabilities.


curl http://localhost/related.php &

curl http://localhost/artist_rank.php &

curl http://localhost/sitemap.php &
r3wt / subarrays.php
Last active Aug 29, 2015
create a contiguous subarray lambda
View subarrays.php
function create_csl($length = 3,$comparison_operator = '>')
$fn = '';
$i = 0;
if($i == 0)
r3wt / gist:83629275bd3a153915ef
Last active Jan 24, 2018
Rollback hhvm on ubuntu
View gist:83629275bd3a153915ef
1. go to and right click and copy the link to the version of hhvm you want to rollback to
2. sudo apt-get autoremove hhvm -y
3. wget <link you just copied>
4. sudo dpkg -i <name of file u just downloaded>
5. apt-get install -f
6. service hhvm start
Edit: Don't worry when it errors out on step 4. that is expected. just continue to step 5.
You can’t perform that action at this time.