Skip to content

Instantly share code, notes, and snippets.

@grayside
grayside / Dockerfile
Created December 20, 2017 17:49
Static website in a Docker container, built with Nodejs tools
# This Dockerfile uses multi-stage builds: https://docs.docker.com/engine/userguide/eng-image/multistage-build/
# The builder image has all the dependencies necessary to assemble the website.
FROM node:8-alpine as builder
# The COPY operation looks to see if any of the source files changed since the last time the container was built.
# If not changed, it uses the cached copy of this operation. If it is changed, it performs the copy and all
# following steps for the builder, and for the COPY operation in the nginx image below.
COPY ./package.json ./package-lock.json /code/frontend/
WORKDIR /code/frontend
RUN npm install
@mkochendorfer
mkochendorfer / userstyle.css
Last active May 30, 2017 19:44
Flowdock userstyle.css
/* On OSX, place this at ~/Library/Application Support/Flowdock/userstyle.css */
/* Override default flow colors with P2 branding colors */
.flow-tab:nth-child(5n+1) .tab-avatar {
background: #fe7900 !important;
}
.flow-tab:nth-child(5n+2) .tab-avatar {
background: #febd3b !important;
}
.flow-tab:nth-child(5n+3) .tab-avatar {
@crittermike
crittermike / delete_branch.sh
Created May 3, 2017 14:03
Delete already-merged git branches (except for specific ones you name)
git branch --merged | grep -v "\*" | grep -v master | grep -v develop | grep -v release | xargs -n 1 git branch -d
@w00fz
w00fz / sphp.sh
Last active February 7, 2022 00:12
PHP switcher
#!/bin/bash
# Check if command was ran as root.
if [[ $(id -u) -eq 0 ]]; then
echo "The command \"sphp\" should not be executed as root or via sudo directly."
echo "When a service requires root access, you will be prompted for a password as needed."
exit 1
fi
# Usage
@crittermike
crittermike / delete_field.php
Last active March 3, 2017 16:07
How to delete and purge a field in Drupal 8
<?php
// Usually, you'll want to run this inside an update hook.
$field = FieldStorageConfig::loadByName($entity_type, $field_name);
$field->delete();
field_purge_field($field); // This part also happens automatically when cron runs.
@illepic
illepic / private-github-release-download.sh
Last active August 3, 2024 16:44
Download the latest release binary from a private GitHub repo. (i.e. a .tar.gz that you have manually uploaded in a GitHub release). Update OAUTH_TOKEN, OWNER, REPO, FILE_NAME with your custom values.
#!/usr/bin/env bash
# Authorize to GitHub to get the latest release tar.gz
# Requires: oauth token, https://help.github.com/articles/creating-an-access-token-for-command-line-use/
# Requires: jq package to parse json
# Your oauth token goes here, see link above
OAUTH_TOKEN="34k234lk234lk2j3lk4j2l3k4j2kj3lk"
# Repo owner (user id)
OWNER="your-user-name"
@vsouza
vsouza / .bashrc
Last active September 21, 2024 12:31
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@staltz
staltz / introrx.md
Last active September 20, 2024 10:10
The introduction to Reactive Programming you've been missing
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete