Skip to content

Instantly share code, notes, and snippets.

@BenGitsCode
BenGitsCode / link-to-video.md
Last active August 14, 2017 17:58
How to render a preview image that links to a video on GitHub
@BenGitsCode
BenGitsCode / Clone-Github-Wiki-Pages.sh
Last active August 7, 2017 15:20 — forked from hanxue/Clone-Github-Wiki-Pages.sh
Cloning Github Wiki Pages
# [ Modified from original => https://github.com/BenGitsCode/instructors.git ]
hanxue-mac:Github hanxue$ git clone https://github.com/AppScale/appscale.wiki.git
Cloning into 'appscale.wiki'...
remote: Counting objects: 1745, done.
remote: Compressing objects: 100% (1733/1733), done.
remote: Total 1745 (delta 1089), reused 10 (delta 4)
Receiving objects: 100% (1745/1745), 267.93 KiB | 35.00 KiB/s, done.
Resolving deltas: 100% (1089/1089), done.
@BenGitsCode
BenGitsCode / gitclean.sh
Created June 14, 2017 23:54 — forked from ericelliott/gitclean.sh
gitclean.sh - cleans merged/stale branches from origin
git remote prune origin
git branch -r --merged master | egrep -iv '(master|develop)' | sed 's/origin\///g' | xargs -n 1 git push --delete origin
@BenGitsCode
BenGitsCode / ArraysAndCallbacks.js
Created April 5, 2017 20:36
Javascript Array iteration, callbacks and function syntax
//ARRAY ITERATION METHODS USING AN ANONYMOUS CALLBACK
// const addOne = function(number){
// return (number + 1)
// }
const arr = [1,2,3,4,5]
console.log(arr.forEach(function addOne(actualItem, indexOfItem, arrayWereGoingThrough){
console.log('actual item: ', actualItem, 'index of item ', indexOfItem)
@BenGitsCode
BenGitsCode / gist:1ed58b7c133019afc5a0979db6335c50
Created March 14, 2017 13:05 — forked from while0pass/listchars.vim
show/hide hidden characters in Vim
" show hidden characters in Vim
:set list
" settings for hidden chars
" what particular chars they are displayed with
:set lcs=tab:▒░,trail:▓
" or
:set listchars=tab:▒░,trail:▓
" used \u2592\u2591 for tab and \u2593 for trailing spaces in line.
" In Vim help they suggest using ">-" for tab and "-" for trail.
@BenGitsCode
BenGitsCode / gist:3a8146e1eb51082791631e0075795145
Created March 14, 2017 13:05 — forked from while0pass/listchars.vim
show/hide hidden characters in Vim
" show hidden characters in Vim
:set list
" settings for hidden chars
" what particular chars they are displayed with
:set lcs=tab:▒░,trail:▓
" or
:set listchars=tab:▒░,trail:▓
" used \u2592\u2591 for tab and \u2593 for trailing spaces in line.
" In Vim help they suggest using ">-" for tab and "-" for trail.
import Ember from 'ember';
export default Ember.Route.extend({
model(/*params*/) { // or model: function() { }
return retrieveModel(); // return your model
}
// model() referred to as `model hook` because it's a specific method invoked
// by the Ember framework every time it needs to handle a web request.
@BenGitsCode
BenGitsCode / protips.js
Created February 28, 2017 16:49 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@BenGitsCode
BenGitsCode / sublime-text-3-setup.md
Created February 27, 2017 17:14 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@BenGitsCode
BenGitsCode / DiffMergeToolconfig.gitconfig
Last active February 17, 2017 01:06
Ben's Git Snippets and such
# DiffMerge diff and merge tools
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = diffmerge \"$LOCAL\" \"$REMOTE\"
[merge]
tool = diffmerge
[mergetool "diffmerge"]
cmd = "diffmerge --merge --result=\"$MERGED\" \"$LOCAL\" \"$(if test -f \"$BASE\"; then echo \"$BASE\"; else echo \"$LOCAL\"; fi)\" \"$REMOTE\""
trustExitCode = true