Skip to content

Instantly share code, notes, and snippets.

@ericroberts
ericroberts / anagram.js
Last active August 29, 2015 14:17
Doing the anagram exercise from exercism.io
var anagram = function(word) {
return new Anagram(word);
};
function Anagram(word) {
this.matches = matches;
function matches() {
possible_anagrams = retrieveAnagrams(arguments);
return possible_anagrams.filter(function(anagram) {
@jonathanheron
jonathanheron / gist:5910535ce7d393193311
Last active October 1, 2015 13:43
Installation snippet for Intercom Messenger for the Acquire plan
<!-- Add this just before your closing </body> tag -->
<!-- Replace 'APP_ID' with your app ID -->
<script>
window.intercomSettings = { app_id: 'APP_ID' };
</script>
<!-- Replace 'APP_ID' with your app ID -->
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/APP_ID';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
@jfilip
jfilip / merged_branch_cleanup.rb
Last active February 21, 2016 05:42
Cleanup your local merged branches from a remote repository!
#!/usr/bin/env ruby
class MergedBranchCleanup
attr_reader :remote, :branch
class << self
def run(remote="origin", branch="master")
MergedBranchCleanup.new(remote, branch).start
end
@demetriusnunes
demetriusnunes / Component.js
Created December 18, 2015 18:49
Concise component definition for AngularJS 1.x
'use strict';
angular.module('Component', [])
.factory('Component', function () {
return function(bindings, template, linkFn, options) {
var directive = {
scope: parseBindings(bindings),
template: parseTemplate(template),
link: linkFn
@coreyfarrell
coreyfarrell / npm-clone.sh
Created August 5, 2018 20:26
Script to clone by npm name
#!/bin/sh -e
npmname=$1
destination=/usr/src/npm/$npmname
if test -d $destination; then
echo "$npmname is already cloned into:"
echo " $destination"
exit 0
fi
const markdownIt = require('markdown-it')
const frontMatter = require('front-matter')
const Prism = require('prismjs')
const aliases = {
'js': 'jsx',
'html': 'markup'
}
const highlight = (str, lang) => {
@dansilivestru
dansilivestru / .bithoundrc
Last active March 25, 2019 12:23
default .bithoundrc file for ignoring project files (modify as needed and commit to the root of your project)
{
"ignore": [
"**/deps/**",
"**/node_modules/**",
"**/thirdparty/**",
"**/third_party/**",
"**/vendor/**",
"**/**-min-**",
"**/**-min.**",
"**/**.min.**",
@koreno
koreno / README.md
Last active April 1, 2020 10:44
'rebaser' improves on 'git rebase -i' by adding information per commit regarding which files it touched.

Prebase

git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.

  • Each file gets an alpha-numeric identifier at a particular column, a list of which appears below the commit list. (The identifiers wrap around after the 62nd file)
  • Commits can be moved up and down safely (without conflicts) as long as their columns don't clash (they did not touch the same file).

Installation

Add the executable to your path and git will automatically expose it as

@ktmud
ktmud / gulpfile.js
Last active February 28, 2022 10:39
An example gulpfile.js with bower components and live reload support
var BatchStream = require('batch-stream2')
var gulp = require('gulp')
var coffee = require('gulp-coffee')
var uglify = require('gulp-uglify')
var cssmin = require('gulp-minify-css')
var bower = require('gulp-bower-files')
var stylus = require('gulp-stylus')
var livereload = require('gulp-livereload')
var include = require('gulp-include')
var concat = require('gulp-concat')
@JaKXz
JaKXz / .editorconfig
Last active November 7, 2022 06:09
Starter for writing projects.
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged