Skip to content

Instantly share code, notes, and snippets.

View chasevida's full-sized avatar

Mark Coleman chasevida

View GitHub Profile
@chasevida
chasevida / makeRequestEffect.js
Last active January 21, 2020 01:20
Redux Observable / RXJS request effect helper (when you need to get some external auth for headers etc.)
import { of } from 'rxjs'
import { ajax } from 'rxjs/ajax'
import { mergeMap, catchError, flatMap } from 'rxjs/operators'
import { ofType } from 'redux-observable'
import { getAuthClient } from 'auth' // replace with your own auth client
const createAuthHeaderRequest = ({ debug }) => async () => {
const authClient = getAuthClient()
@chasevida
chasevida / Docker - Delete All Containers & Images
Created March 30, 2016 22:38
Docker - Delete All Containers & Images
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@chasevida
chasevida / hapi-graphql-example.js
Created February 18, 2016 03:42
Hapi GraphQL simple example
var Hapi = require('hapi');
var GraphQL = require('./lib');
var GQL = require('graphql');
var GraphQLSchema = GQL.GraphQLSchema;
var GraphQLObjectType = GQL.GraphQLObjectType;
var GraphQLInt = GQL.GraphQLInt;
@chasevida
chasevida / gist:3fef7ded97a9403a1290
Last active October 29, 2015 19:35
Resolving Permission Errors - /usr/local and ~/.local

When getting up and running with a new machine I often run into this issue and completely forget why on earth it's happening. This StackOverflow post gives the overview of the issue and solution.

Essentially on a default installation this folder is owned by root and missing the appropriate permissions for your user. So the commands in usr/local/bin only work when used with sudo. To resolve this we can take ownership of /usr/local by running the following:

$ sudo chown -R $(whoami) /usr/local

$ sudo chown -R $(whoami) ~/.local

That second command is helpful for npm packages making use of the .local folder.

@chasevida
chasevida / gist:1961f881afc58da13ecb
Last active January 8, 2016 16:27
nginx.conf for silverstripe & homestead
server {
listen 80;
server_name sitename.local;
root /home/vagrant/path/to/directory/sitename;
index framework/main.php;
charset utf-8;
location / {
@chasevida
chasevida / gist:5b80f4dc650f8add5143
Created October 1, 2014 20:18
Hide/Show Desktop Icons in Mac OS X

Hide all desktop icons:

$ defaults write com.apple.finder CreateDesktop -bool false
$ killall Finder

Show all desktop icons:

@chasevida
chasevida / gist:84e752684cbe5b3256bc
Last active August 3, 2016 13:19
npm - EACCESS Errors

These three steps worked for me to remove the constant npm EACCESS errors I was recieving.

  1. Reclaim ownership of the .npm directory
  2. Add need write permissions for the node_modules directory
  3. Finally sort the ownership of the npm bin too

From the terminal use the following commands to achieve the above"

  1. $ sudo chown -R `whoami` ~/.npm
  2. $ sudo chown -R `whoami` /usr/local/lib/node_modules
@chasevida
chasevida / Recursively rename files
Created October 28, 2013 21:25
Recursively rename files based on extensions. In this particular case, rename files with the '.png' extension to '@2x.png' for retina files not already labelled as such within a given directory.
find . -type f -name '*.'png -print | while read file; do echo "renaming $file to $(basename $file .png)@2x.png"; mv "$file" "$(dirname $file)/$(basename $file .png)@2x.png"; done