Skip to content

Instantly share code, notes, and snippets.

Avatar

Jared Grippe deadlyicon

View GitHub Profile
@deadlyicon
deadlyicon / params.js
Last active Aug 29, 2015
A tiny way to parse and generate url params AKA search or query strings
View params.js
Params = {};
Params.parse = function(search){
var params = {};
if (search[0] === '?') search = search.substring(1);
search.split('&').forEach(function(param) {
var parts = param.split('=');
var key = decodeURIComponent(parts[0]);
var value = decodeURIComponent(parts[1]);
if (value === 'undefined') return;
@deadlyicon
deadlyicon / flex.sass
Last active Aug 29, 2015
flex mixins for compass
View flex.sass
=display-flex
+experimental-value(display, flex, -moz, -webkit, not -o, -ms, not -khtml, official)
=flex-direction($value)
+experimental(flex-direction, $value, -moz, -webkit, not -o, -ms, not -khtml, official)
=flex-wrap($value)
+experimental(flex-wrap, $value, -moz, -webkit, not -o, -ms, not -khtml, official)
View react.md

This was so eleganet an beautiful

div({className: 'foo'}
  h1(null, 'Hello World')
  h2(null, 'Some subtext')
  p(null, 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod…')
)
View react.md

This was so eleganet an beautiful

div({className: 'foo'}
  h1(null, 'Hello World')
  h2(null, 'Some subtext')
  p(null, 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod…')
)
View invert.js
(
function () {
var css = 'html {-webkit-filter: invert(100%);' +
'-moz-filter: invert(100%);' +
'-o-filter: invert(100%);' +
'-ms-filter: invert(100%); }',
head = document.getElementsByTagName('head')[0],
style = document.createElement('style');
if (!window.counter) { window.counter = 1;} else { window.counter ++;
View .gitconfig
[alias]
l = log --oneline --decorate --graph -20 --branches
st = status -s -b
co = checkout
ci = commit
br = branch
[color]
status = auto
diff = auto
branch = auto
View .irbrc
module Method::Editable
def edit
if !respond_to?(:source_location)
puts "#{self} has no source location"
else
path, line_number = source_location
system(%[$EDITOR "#{path}:#{line_number}"])
end
end
end
@deadlyicon
deadlyicon / location.params.js
Created Jul 9, 2015
location.params getter and setter
View location.params.js
Location = window.location.constructor
Object.defineProperty(Location.prototype, 'params', {
get: function(){
'use strict';
var regex = /([^&=]+)=?([^&]*)/g;
var match, params = {};
var search = this.search
search = search.substring(search.indexOf('?') + 1, search.length);
View imgur.test.rb
#!/usr/bin/env ruby
require 'base64'
require 'httparty'
require "open-uri"
# data = Base64.encode64(File.read('/Users/jaredgrippe/Downloads/IMG_4389.JPG'))
data = Base64.encode64(open('http://data.whicdn.com/images/19862300/superthumb.jpg').read)
response = HTTParty.post('https://api.imgur.com/3/upload',