Skip to content

Instantly share code, notes, and snippets.

<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
" Put this in your .vimrc
" Jump to the last position of the cursor except for git commits
function! PositionCursorFromViminfo()
if !(bufname("%") =~ '\(COMMIT_EDITMSG\)') && line("'\"") > 1 && line("'\"") <= line("$")
exe "normal! g`\""
endif
endfunction
au BufReadPost * call PositionCursorFromViminfo()
@icecreammatt
icecreammatt / coreos-cloud-config
Last active August 29, 2015 14:18
CoreOS Cloud-config
#cloud-config
coreos:
update:
reboot-strategy: off
etcd:
discovery: https://discovery.etcd.io/<token>
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
@staxmanade
staxmanade / UIImage+FailFast.h
Created February 12, 2015 17:01
Fail Fast and assert when [UIImage imageNamed:name] cannot load an image
//
// UIImage+FailFast.h
//
// Created by Jason Jarrett on 2/11/15.
// Copyright (c) 2015 Jason Jarrett. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (FailFast)
@jimmycuadra
jimmycuadra / cloud-config.yml
Last active April 19, 2021 03:04
CoreOS cloud-config for DigitalOcean with iptables firewall
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
discovery: https://discovery.etcd.io/<token>
# multi-region deployments, multi-cloud deployments, and droplets without
# private networking need to use $public_ipv4
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
@joekarl
joekarl / gist:86d9bdb8f9af044710b7
Last active May 23, 2016 13:41
go-libapns example app
package main
import (
apns "github.com/joekarl/go-libapns"
"fmt"
"io/ioutil"
"time"
)
type HandleCloseErrorFn func (closeError *apns.ConnectionClose)
@wangkuiyi
wangkuiyi / pre-commit-clang-format
Last active August 19, 2021 14:04
Git pre-commit hook that invokes clang-format to reformat C/C++/Objective-C source code.
#!/bin/bash
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by [email protected]
# This file is part of a set of unofficial pre-commit hooks available
# at github.
@yarcowang
yarcowang / docker-log.sh
Last active January 6, 2023 21:16
simple bash script to show log for a docker image
#!/usr/bin/env bash
DOCKER=`which docker`
usage()
{
echo "Usage: $(basename $0) [-l num] IMAGE"
exit 0
}
@garystafford
garystafford / helpful-npm-commands.sh
Last active December 8, 2021 12:40
My list of helpful node/npm/bower commands
###############################################################################
# Helpful npm commands and code snippets
###############################################################################
# list top level packages w/o dependencies
npm list --depth=0
npm list --depth=0 -g
# list top level packages that are outdated w/o dependencies
npm outdated | sort
@addyosmani
addyosmani / package.json
Last active December 28, 2024 12:07
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",