Skip to content

Instantly share code, notes, and snippets.

@patik
patik / how-to-squash-commits-in-git.md
Last active October 17, 2023 02:19
How to squash commits in git

Squashing Git Commits

The easy and flexible way

This method avoids merge conflicts if you have periodically pulled master into your branch. It also gives you the opportunity to squash into more than 1 commit, or to re-arrange your code into completely different commits (e.g. if you ended up working on three different features but the commits were not consecutive).

Note: You cannot use this method if you intend to open a pull request to merge your feature branch. This method requires committing directly to master.

Switch to the master branch and make sure you are up to date:

@Ambroos
Ambroos / Ad.jsx
Created April 29, 2015 14:18
Loading synchronous / document.write-ing ads asynchronously against their will in a React component
import React from 'react';
import $script from 'scriptjs';
require('postscribe/htmlParser/htmlParser.js'); // This is required for postScribe, postScribe is a bit annoying.
const postscribe = require('exports?postscribe!postscribe'); // Needs webpack exports-loader! Otherwise, just require it and use window.postscribe.
// This GlobalAdCodePromise is a simple promise that uses script.js to load a javascript file and then resolve.
const GlobalAdCodePromise = new Promise((resolve) => {
setTimeout(() => {
$script('http://annoying.adprovider.com/ad.js', () => {
@paulrobertlloyd
paulrobertlloyd / figure.html
Created January 9, 2015 21:26
Custom Liquid tag block to render a figure with optional caption
<!-- Arguments without quotes -->
<!-- ISSUE: Only content between first two quotes rendered -->
<figure class="figure class1"><div class="figure__main">
<p><img src="/assets/images/2008/12/chicago.jpg" alt="" /></p>
</div><figcaption class="figure__caption"><p>Cloud&nbsp;Gate</p>
</figcaption></figure>
<!-- Arguments with single quotes, regardless of content -->
<!-- ISSUE: Nothing generated if argument contains quotes -->
<figure class="figure class1 class2"><div class="figure__main">
@rothgar
rothgar / gist:7131900
Created October 24, 2013 05:37
Ansible one liners
###Deploy SSH key to ansible inventory###
for server in $(ansible --list-hosts all); do ssh-copy-id -i ~/.ssh/id_rsa.pub $server; done
@atmos
atmos / heaven.md
Last active November 23, 2020 22:35
Response to a dude who asked about heaven. https://github.com/holman/feedback/issues/422

@holman got a request about our deployment system, heaven

I know it's not a high priority, but has there been any activity on open-sourcing the core Heaven gem?

There is. I've been working on extracting the non-GitHub specific parts into two gems. This first is a CLI portion called hades. The second is an HTTP API portion called heaven.

When you open source something previously used as in internal tool like Heaven, Hubot, Boxen, etc., how do you manage and hook in the parts that need to stay internal?

Normally I focus around four questions:

@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@scollett
scollett / gollum.config.ru
Last active July 20, 2017 07:38
A lightweight author identification for Gollum wiki (with some preferences). Use config.ru to run Gollum as a rack application. Basic HTTP Authentication is commented out.
#!/usr/bin/env ruby
require 'rubygems'
require 'gollum/app'
gollum_path = File.expand_path(File.join(File.dirname(__FILE__), 'database.git')) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
Precious::App.set(:wiki_options, {:live_preview => false, :universal_toc => false, :user_icons => 'gravatar'})
module Precious
class App < Sinatra::Base
# Creates a simple authentication layer
@romansklenar
romansklenar / REAME.md
Last active February 19, 2020 14:14
How to set up your VPS with Chef Solo

How to set up your VPS with Chef Solo

1. What is it?

There are many different provisioning tools out there, the most popular of which are Chef and Puppet. Chef uses Ruby, Puppet uses a DSL (Domain Specific Language), there are others that use simple bash too, but today we're going to focus on Chef Solo.

2. Dependencies

To get Chef working properly on your local machine you need a few things.

Make sure you use Ruby 1.9.x and not Ruby 2.x as you will get errors with the json 1.6.1 gem on 2.x. Use rbenv or RVM to manage several different Rubies on the one machine.

@jfryman
jfryman / personal_boxen_manifest.pp
Last active November 30, 2019 05:05
Personal Boxen Manifest
class people::jfryman {
# Applications
include chrome::stable
include onepassword
include dropbox
include alfred
include macvim
include zsh
include homebrew
include fitbit

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file: