Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Quick stepquick

View GitHub Profile
@ryanflorence
ryanflorence / rails-ey.jsx
Last active Feb 2, 2018
Rail-ey style routes
View rails-ey.jsx
const lookup = (namespace) => {
// if you really want rails-style indirection, you'd
// need an app container that could look up modules
// by strings.
}
const Resources = ({ namespace }) => {
const Layout = lookup(namespace, 'layout')
return (
<Route path={`/${namespace}`} render={() => (
@staltz
staltz / .bashrc
Created Mar 7, 2017
Show a macOS notification when a terminal task is done
View .bashrc
# Name it whatever you want. I like `y` because in my keyboard layout it's close to `;`
function y() {
previous=$?
if [ $previous -eq 0 ]; then
osascript -e "display notification \"Done\" with title \"Terminal Task\"" && say "it is done";
else
osascript -e "display notification \"Failed\" with title \"Terminal Task\"" && say "it went to the trees";
fi
}
View docker-compose.yml
version: '2'
services:
traefik:
image: traefik
command: -c /dev/null --web --docker --docker.domain=docker.localhost --logLevel=DEBUG --entryPoints="Name:https Address::443 TLS:/certs/server.crt,/certs/server.key;/certs_br/server.crt,/certs_br/server.key" --entryPoints="Name:http Address::80 Redirect.EntryPoint:https"
ports:
- "80:80"
- "8080:8080"
@acdlite
acdlite / app.js
Last active Aug 18, 2020
Quick and dirty code splitting with React Router v4
View app.js
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@PierBover
PierBover / Main.jsx
Created Jul 16, 2016
JWT Auth React Router async wait
View Main.jsx
import React from 'react'
export default class Main extends React.Component {
constructor(props){
super(props)
this.state = {}
}
componentWillMount(){
this.checkAuth()
@btroncone
btroncone / ngrxintro.md
Last active Sep 17, 2020
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series
View ngrxintro.md

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@fideloper
fideloper / update_curl.sh
Last active Sep 8, 2020
Update curl on Ubuntu 14.04
View update_curl.sh
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
@taylorotwell
taylorotwell / global-homestead.sh
Created Sep 23, 2015
Global Homestead Without Composer
View global-homestead.sh
alias homestead='function __homestead() { (cd ~/Documents/Code/Homestead && vagrant $*); unset -f __homestead; }; __homestead'
# Usage
homestead up
homestead halt
# etc...
@seyDoggy
seyDoggy / SomeCtrl.js
Last active Sep 20, 2017
My version of the AngularJS ui-bootstrap alert service as derived from here: https://coderwall.com/p/r_bvhg/angular-ui-bootstrap-alert-service-for-angular-js. No $rootScopes were harmed in the making of this code.
View SomeCtrl.js
(function () {
'use strict';
angular.module('myApp')
.controller('SomeCtrl', SomeCtrl);
SomeCtrl.$inject = ['$scope', '$http', ' alertService'];
function SomeCtrl($scope, $http, alertService) {
$http.put('http://some.url/user/44', {
@thepsion5
thepsion5 / EloquentFooRepository.php
Created May 2, 2014
Example implementation of a Eloquent-based repository that provides a fluent interface for sorting and pagination without exposing the underlying model API.
View EloquentFooRepository.php
<?php
class EloquenFooRepository
{
/**
* The base eloquent model
* @var Eloquent
*/
protected $model;
You can’t perform that action at this time.