Skip to content

Instantly share code, notes, and snippets.

View andersr's full-sized avatar
😅
Focusing

Anders Ramsay andersr

😅
Focusing
View GitHub Profile
set -g -x fish_greeting ''
// set -g -x PATH /usr/local/bin $PATH
alias fconfig="code ~/.config/fish/config.fish"
alias freload="source ~/.config/fish/config.fish"
alias zl="cd /Users/andersjramsay/dev/zl"
alias gst="git status"
function g
git $argv
{
"workbench.startupEditor": "newUntitledFile",
"editor.wordWrap": "on",
"terminal.integrated.fontFamily": "Source Code Pro for Powerline",
"files.insertFinalNewline": true,
"editor.formatOnSave": true,
"editor.snippetSuggestions": "top",
"typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib",
"workbench.iconTheme": "vscode-icons",
"files.exclude": {
@andersr
andersr / git-co
Created September 14, 2018 14:16
#!/bin/zsh
((!$#)) && echo No matching branch found && exit 1
git checkout $1
{
"characters":
[
{
"name": "Luke Skywalker",
"url": "http://swapi.co/api/people/1/"
},
{
"name": "Darth Vader",
"url": "http://swapi.co/api/people/4/"
WEATHER_ICON_CODES = {
"200": {
"label": "thunderstorm with light rain",
"icon": "storm-showers"
},
"201": {
"label": "thunderstorm with rain",
"icon": "storm-showers"
},
@andersr
andersr / global_namespaced_var.js
Created November 4, 2016 16:09
Example of namespaced global variable
var utils = {
isEmpty: function (str) {
return str.trim().length === 0
},
isEmail: function (email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/
return regex.test(email)
}
}
@andersr
andersr / 0_reuse_code.js
Created October 14, 2016 11:36
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
const fetchJSON = url =>
fetch(url, { method: 'GET' })
.then(response => response.json())
for (var i = 1; i <= 100; i++) {
if (i % 3 === 0 && i % 5 === 0) {
console.log('fizzbuzz')
} else if (i % 3 === 0) {
console.log('fizz')
} else if (i % 5 === 0) {
console.log('buzz')
}
}
@andersr
andersr / var_check.js
Created October 7, 2016 12:58
JS check if undeclared, undefined or null
//check if undeclared
try{
undeclaredVar
}
catch(e) {
if(e.name === 'ReferenceError') {
console.log('var is undeclared')
}
}