Skip to content

Instantly share code, notes, and snippets.

@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@Schniz
Schniz / Dockerfile
Created March 31, 2016 14:17
DemocracyOS Docker image for isolated networks
FROM node
ENV PORT 80
EXPOSE 80
ENV NODE_ENV production
RUN git clone https://github.com/DemocracyOS/democracyos.git /opt/app
WORKDIR /opt/app
RUN npm install
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@ChuckJHardy
ChuckJHardy / digital_ocean_setup.md
Last active October 27, 2023 17:51
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

# lib/capistrano/tasks/assets.rake
Rake::Task['deploy:assets:precompile'].clear
namespace :deploy do
namespace :assets do
desc 'Precompile assets locally and then rsync to remote servers'
task :precompile do
local_manifest_path = %x{ls public/assets/manifest*}.strip
@dmangiarelli
dmangiarelli / GitForWindowsSetup.md
Last active May 8, 2024 04:09
How to setup SSH with Git for Windows

How to setup Git for Windows

I know this document seems long, but it shouldn't be too difficult to follow. This guide is based on Windows, but every program here has Linux/Mac equivalents, and in most cases they're built-in. So, take a deep breath and go step by step.

The steps below are for GitHub, but the steps are almost idential for Bitbucket, Heroku, etc.

You'll probably want to make sure Chocolatey is installed, since it streamlines installing this stuff later. If you install via Chocolatey, you don't need to run the installers from the products' respective sites.

Cmder / ConEmu

@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@hlung
hlung / How to connect a PS3 controller.md
Last active March 25, 2024 14:45
How to connect PS3 controller on Mac OSX, PC

How to connect PS3 controller on Mac OSX, PC, etc.

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.

Here are the steps:

@interactivellama
interactivellama / jgroup
Created June 3, 2013 17:46
jgroup is a LESS mixin that justifies inline-block elements, removes typography issues by reducing the font-size, and adds a 100% width element to the end simliar to micro-clearfix, but not. Look Ma, no specifying margins! Be carful though of removing spaces / HTML compression in production.
/* Justify inline block elements for a percentage grid without specifying margins: LESS mixin. See http://www.barrelny.com/blog/text-align-justify-and-rwd/ */
.jgroup {
text-align: justify;
font-size: .01px;
&:after{
content: '';
display: inline-block;
width: 100%;
@dansimau
dansimau / gist:842415
Created February 24, 2011 16:41
Bash function for running a command, checking the return code, and re-trying it x times after y sleep seconds.
#
# "<cmd>" <retry times> <retry wait>
#
do_retry()
{
cmd="$1"
retry_times=$2
retry_wait=$3
c=0