Skip to content

Instantly share code, notes, and snippets.

View bericp1's full-sized avatar

Brandon Phillips bericp1

View GitHub Profile
let x = 0;
async function test() {
x += await 2;
console.log(x);
}
test();
x += 1;
console.log(x);
@bericp1
bericp1 / config.ex
Created March 31, 2018 20:30 — forked from gmodarelli/config.ex
Useful config wrapper for Elixir
defmodule Config do
@moduledoc """
This module handles fetching values from the config with some additional niceties
"""
@doc """
Fetches a value from the config, or from the environment if {:system, "VAR"}
is provided.
An optional default value can be provided if desired.
@bericp1
bericp1 / homestead.sh
Created August 23, 2017 19:26
Homestead bash function
homestead() {
VAGRANT_CWD=$HOME/Homestead vagrant $@
}
@bericp1
bericp1 / scroll-monitor.js
Created April 24, 2017 01:30 — forked from jacob-beltran/scroll-monitor.js
React Performance: Scroll Monitor Example
class ScrollMonitor extends React.Component {
constructor() {
this.handleScrollStart = this.startWatching.bind( this );
this.handleScrollEnd = debounce(
this.stopWatching.bind( this ),
100,
{ leading: false, trailing: true } );
}
componentDidMount() {
@bericp1
bericp1 / supervisord
Last active February 18, 2017 01:28
A init.d script for supervisor on Amazon Linux AMI
#!/bin/bash
#
# supervisor Start/Stop the supervisor daemon.
#
# chkconfig: 345 90 10
# description: Supervisor is a client/server system that allows its users to
# monitor and control a number of processes on UNIX-like operating
# systems.
. /etc/init.d/functions
{
"private": true,
"devDependencies": {
"dotenv": "^2.0.0",
"gulp": "^3.8.8",
"gulp-clean": "^0.3.1",
"gulp-exec": "^2.1.2",
"gulp-file": "^0.2.0",
"gulp-filter": "^4.0.0",
"gulp-html-replace": "^1.5.4",
class FriendshipRepository implements Contract {
public function countAccepted($user) {
$user = $user instanceof User ? $user->id : $user;
return $this->model->where('user_id', $user)
->where('status', 'accepted')
->count();
}
}
private function allVisibleQuery(array $with = null) {
return $this->model->with(is_null($with) ? $this->with : $with)
->where(function($query) {
return $query->doesntHave('roles', 'or', function($q) {
return $q->whereIn('name', [config('auth.hidden_role'), config('auth.blocked_role')]);
});
});
}
{"features":[{"id":"57971f42c203bc0ff","type":"feature-schedule","name":"Schedule","icon":"13","settings":{"type":"schedule-settings","timeFormat":"12","timeZone":"US/Eastern","multiTrack":true},"sessions":[{"id":"9dcb88e0137649590","type":"schedule-session","startTime":"2015-10-27T08:30:00-0400","endTime":"2015-10-27T11:00:00-0400","title":"Mastering the North Carolina STEM Recognition Process","description":"<p>Introduces participants to the NC STEM Recognition process and provides them with practical instruction on preparing for and completing the requirements to become a recognized STEM school. Specific topics addressed in this session include:</p>\n<ul>\n<li>Defining STEM in North Carolina</li>\n<li>Understanding the 11 STEM Attributes and the Attribute Implementation Rubric</li>\n<li>Using the Implementation Rubric for self-assessment</li>\n<li>Dissecting the STEM Recognition application process</li>\n<li>Connecting to the NC STEM Center</li>\n</ul>\n<p>Participants also will hear from K-12 teachers and
{"features":[{"id":"57971f42c203bc0ff","type":"feature-schedule","name":"Schedule","icon":"13","settings":{"type":"schedule-settings","timeFormat":"12","timeZone":"US/Eastern","multiTrack":true},"sessions":[{"id":"9dcb88e0137649590","type":"schedule-session","startTime":"2015-10-27T08:30:00-0400","endTime":"2015-10-27T11:00:00-0400","title":"Mastering the North Carolina STEM Recognition Process","description":"<p>Introduces participants to the NC STEM Recognition process and provides them with practical instruction on preparing for and completing the requirements to become a recognized STEM school. Specific topics addressed in this session include:</p>\n<ul>\n<li>Defining STEM in North Carolina</li>\n<li>Understanding the 11 STEM Attributes and the Attribute Implementation Rubric</li>\n<li>Using the Implementation Rubric for self-assessment</li>\n<li>Dissecting the STEM Recognition application process</li>\n<li>Connecting to the NC STEM Center</li>\n</ul>\n<p>Participants also will hear from K-12 teachers and