Skip to content

Instantly share code, notes, and snippets.

View rxgx's full-sized avatar

Ryan Gasparini rxgx

View GitHub Profile
@rxgx
rxgx / Reset Table IDs.sql
Created June 26, 2010 01:05
Reset table IDs and AUTO_INCREMENT
ALTER TABLE `users` DROP `id`;
ALTER TABLE `users` AUTO_INCREMENT = 1;
ALTER TABLE `users` ADD `id` int UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
@rxgx
rxgx / webkit-scrollbar.css
Last active October 30, 2015 16:25
scrollbar styles taken from the Chrome store
::-webkit-scrollbar,
::-webkit-scrollbar-thumb {
overflow: visible;
border-radius: 0;
border: solid 1px #A6A6A6;
}
::-webkit-scrollbar {
width: 10px;
border-right: 0;
@rxgx
rxgx / coords.txt
Created December 30, 2013 10:52
Legacy Offset & Positioning of Two Elements
x ----
| |
| |
| |
y ---- ---- a
| |
---- b
a > x
a = y
@rxgx
rxgx / helper.rb
Last active January 2, 2016 12:59
Embed JSON on page with ActiveModel::Serializer
module ApplicationHelper
def json_for(target, options = {})
options[:scope] ||= self
options[:url_options] ||= url_options
target.active_model_serializer.new(target, options).to_json
end
end
@rxgx
rxgx / example.css
Created October 9, 2012 22:29
CSS Property Order Convention
css-property-order {
/* Position Values */
top: 0;
right: 0;
bottom: 0;
left: 0;
/* Box Sizing */
width: auto;
@rxgx
rxgx / pr.sh
Created April 19, 2017 17:05
Pull Request Script
# Open browser and submit PR for current branch against master
pr () {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.github.com[:/]\(.*/)\.git.*/\1/"`
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
}
@rxgx
rxgx / eslint-prettier-package.json
Created August 11, 2017 23:21
If ESLint then Prettier
{
"eslintConfig": {
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"es6": true,
@rxgx
rxgx / instagram-embed.html
Last active December 12, 2017 18:04
What you get when requesting an embed for: https://www.instagram.com/p/Bchw14MD64q/
<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-version="7" style=" background:#FFF; border:0; border-radius:3px; box-shadow:0 0 1px 0 rgba(0,0,0,0.5),0 1px 10px 0 rgba(0,0,0,0.15); margin: 1px; max-width:658px; padding:0; width:99.375%; width:-webkit-calc(100% - 2px); width:calc(100% - 2px);">
<div style="padding:8px;">
<div style=" background:#F8F8F8; line-height:0; margin-top:40px; padding:62.5% 0; text-align:center; width:100%;">
<div style=" background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAMUExURczMzPf399fX1+bm5mzY9AMAAADiSURBVDjLvZXbEsMgCES5/P8/t9FuRVCRmU73JWlzosgSIIZURCjo/ad+EQJJB4Hv8BFt+IDpQoCx1wjOSBFhh2XssxEIYn3ulI/6MNReE07UIWJEv8UEOWDS88LY97kqyTliJKKtuYBbruAyVh5wOHiXmpi5we58Ek028czwyuQdLKPG1Bkb4NnM+VeAnfHqn1k4+GPT6uGQcvu2h2OVuIf/gWUFyy8OWEpdyZSa3aVCqpVoVvzZZ2VTnn2wU8qzVjDDetO90GSy9mVLqtgYSy231MxrY6I2gGqjrTY0L8fxCxfCBbhWrsYYAAAAAElFTkSuQmCC); display:block; height:44px; margin:0 auto -44px;
@rxgx
rxgx / addEncryptedToken.js
Last active April 18, 2018 23:03
Auth0 rule to save an encrypted version of Google's refresh token to a user's app_metadata
function (user, context, callback) {
const namespace = 'https://grateful.digital/';
if (
user.app_metadata &&
user.app_metadata.refresh_token_encrypted
) {
const refreshTokenEncrypted = user.app_metadata.refresh_token_encrypted;
context.idToken[namespace + 'refresh_token_encrypted'] = refreshTokenEncrypted;
}