Skip to content

Instantly share code, notes, and snippets.

View crobinson42's full-sized avatar
🏠
Working from home

Cory Robinson crobinson42

🏠
Working from home
  • American Software
  • Northwest USA
View GitHub Profile
@cowboy
cowboy / github_post_recieve.php
Created October 11, 2010 02:04
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@wafe
wafe / gist:2000145
Created March 8, 2012 10:16
node.js uncaughtException logging using winston
var winston = require('winston'); // https://github.com/flatiron/winston
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({ filename : 'winston.log', timestamp: true, /*maxsize: 2000, maxFiles: 5*/ })
]
});
process.on('uncaughtException', function (err) {
@amitchhajer
amitchhajer / Count Code lines
Created January 5, 2013 11:08
Count number of code lines in git repository per user
git ls-files -z | xargs -0n1 git blame -w | perl -n -e '/^.*\((.*?)\s*[\d]{4}/; print $1,"\n"' | sort -f | uniq -c | sort -n
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 30, 2024 23:36
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@afternoon
afternoon / rename_js_files.sh
Created February 15, 2014 18:04
Rename .js files to .ts
find app/src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.ts"' {} \;
@WickyNilliams
WickyNilliams / bad.js
Last active January 30, 2020 17:46
fast builds with grunt and browserify
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
pkg : grunt.file.readJSON("package.json"),
paths : {
src : "<%= pkg.main %>",
@juanpasolano
juanpasolano / api models Locations.js
Created September 9, 2014 21:50
seed database on sails js
/**
* Locations.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
seedData:[
@carlhoerberg
carlhoerberg / reconnect.js
Created May 13, 2015 14:45
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
@joepie91
joepie91 / delay-promise.js
Last active July 29, 2022 20:02
ES6 Promise.delay
module.exports = function(duration) {
return function(){
return new Promise(function(resolve, reject){
setTimeout(function(){
resolve();
}, duration)
});
};
};