Skip to content

Instantly share code, notes, and snippets.

View blake-simpson's full-sized avatar

Blake Simpson blake-simpson

View GitHub Profile
@blake-simpson
blake-simpson / jwt.js
Last active July 11, 2023 15:33
Generate JWT in Expo
import HmacSHA256 from 'crypto-js/hmac-sha256';
import Base64 from 'crypto-js/enc-base64';
import Utf8 from 'crypto-js/enc-utf8';
const header = {
alg: 'HS256',
typ: 'JWT'
};
const body = { foo: 'bar' };
@blake-simpson
blake-simpson / gist:ce28c61c726d3c7608d6
Last active August 29, 2015 14:25
Atom custom stylesheet
// make all JSON content dark blue
.editor[data-grammar="source json"] {
color: @syntax-selection-color;
// make all strings pastel white
&> .string.quoted.json {
color: @syntax-text-color;
}
// make an exception for all .string keys whose immediate parent is .value
@blake-simpson
blake-simpson / gist:440ea8e88771a9c44164
Created October 29, 2014 10:29
Start a browser-sync server for easy live reload
Install Browser Sync with NPM
$ npm install -g browser-sync
Then start the Browser Sync server, point it to the proxy (the real server) and then the port option will be the one you use in the browser. The files argument are the files to watch.
$ browser-sync start --proxy "localhost:3000" --port 3003 --files "app/**
For more config options: http://www.browsersync.io/docs/command-line/
@blake-simpson
blake-simpson / fluid-children.less
Created June 24, 2014 07:52
CSS fluid (unknown N) children (LESS)
.fluid {
&:after {
content: "";
clear: both;
display: block;
}
.item {
float: left;
}
@blake-simpson
blake-simpson / .jshintrc
Created September 1, 2013 16:02
JS hint config dotfile
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
@blake-simpson
blake-simpson / gist:5115461
Created March 8, 2013 10:02
A JavaScript function that checks the size of the scrollbar for the current browser and adds a class to the body allowing CSS styling. Useful when designing cross-browser for OSX where some browsers have an overlaid 0 width scrollbar and other use 15px+. The function could be modified to add a data attribute with the exact width, if you need mor…
// Discovered here then refactored: http://davidwalsh.name/detect-scrollbar-width
var checkScrollbarWidth = function() {
var $body = $("body"),
$div = $('<div class="scrollbar-measure">'),
scrollbarWidth;
$div.appendTo( $body );
scrollbarWidth = $div[0].offsetWidth - $div[0].clientWidth;
$div.remove();
@blake-simpson
blake-simpson / .bash_profile
Last active October 10, 2015 21:38
bash_profile
alias ls='ls -G'
alias lsa='ls -la'
alias g='git'
alias gp="git pull"
alias gpu="git push"
alias gpt="git push --tags"
alias gpp="git pull && git push"
alias gc="git checkout"
alias gs="git status"
@blake-simpson
blake-simpson / gist:3654276
Last active January 6, 2019 22:48
Convert all ERB templates to HAML templates

Prerequisites

You must have the following gems installed:

  • haml (or haml-rails)
  • html2haml
  • hpricot
  • ruby_parser

Create HAML files

@blake-simpson
blake-simpson / .vimrc
Last active October 9, 2022 17:12
Macvim Config
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-rails'
@blake-simpson
blake-simpson / .tm_properties
Created August 10, 2012 15:28
TM Properties: Rails setup
tabSize = 2
softTabs = true
showInvisibles = true
include = "{.rvmrc,.rspec,.gitignore,.tm_properties,.htaccess}"
excludeInFileChooser = "{$excludeInFileChooser,log,vendor,tmp,.sass-cache,uploads}"
excludeInBrowser = "{$excludeInBrowser,log,vendor,tmp,.sass-cache,uploads}"
excludeInFolderSearch = "{$excludeInFolderSearch,log,vendor,tmp,.sass-cache,uploads}"