Skip to content

Instantly share code, notes, and snippets.

View gertig's full-sized avatar

Andrew Gertig gertig

View GitHub Profile
@gertig
gertig / Mac style drop shadow.css
Created August 23, 2012 20:38
Mac style drop shadow
box-shadow:inset 0 1px 0 rgba(255,255,255,.6), 0 22px 70px 4px rgba(0,0,0,0.56), 0 0 0 1px rgba(0, 0, 0, 0.3);
@gertig
gertig / XBeeRGBColor
Created April 5, 2012 02:12
XBee RGB Color picker
/*
XBeeCableReplacement.pde
Control the color of an RGB LED wirelessly via XBee.
Required (in addition to your Arduino):
(These items are found in the SparkFun XBee Wireless Kit Retail product
@gertig
gertig / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Created August 2, 2020 03:02 — forked from stevenharman/00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

@gertig
gertig / machine.js
Created June 23, 2020 01:16
Generated by XState Viz: https://xstate.js.org/viz
const integrationMachine = Machine({
id: "integration",
initial: "noAuthorization",
states: {
noAuthorization: {
on: {
OAUTH_SUCCESS: "needsSiteSelection",
HAS_SITE: "needsCollectionSelection",
HAS_COLLECTION: "needsFieldMapping",
@gertig
gertig / user_agent.m
Created June 6, 2012 03:42
iOS Default User Agent
#pragma mark get user agent
+ (NSString *)defaultUserAgentString
{
@synchronized (self) {
if (!defaultUserAgent) {
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
@gertig
gertig / 1_rmtwrk_devise_mailer.rb
Last active January 21, 2019 23:37
Custom Devise Mailer and views using Mailgun and Premailer
class RmtwrkDeviseMailer < Devise::Mailer
helper :application # gives access to all helpers defined within `application_helper`.
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
default from: 'RMTWRK <rmtwrk@inflowhq.com>'
default reply_to: 'RMTWRK <rmtwrk@inflowhq.com>'
layout 'mailer_rmtwrk'
#############################
# CONFIRMATION EMAIL
Verifying my Blockstack ID is secured with the address 1R3Uo79S42SdauJgefHJaXHFYeiFvrd2F https://explorer.blockstack.org/address/1R3Uo79S42SdauJgefHJaXHFYeiFvrd2F
@gertig
gertig / devise_ajax_signup
Created August 17, 2011 19:31
Devise Ajax Signup
#registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
def create
params[:user][:password_confirmation] = params[:user][:password]
super
end
end
<!-- Inside any View --->
<%= form_for(:user, :url => "#", :html => { :id => "ajax_signup"}) do |f| %>
@gertig
gertig / VisibleToUser.js
Created April 3, 2017 14:21 — forked from jcgertig/VisibleToUser.js
React Pundit
require('./styles.css');
import React, {Component, PropTypes} from 'react';
import { connect } from 'react-redux';
import { meetsPolicy } from 'policies';
class VisibleToUser extends Component {
render() {
let { children, hasUser, type, value, user, action } = this.props;
@gertig
gertig / avatar_uploader.rb
Created July 11, 2012 21:25
Cloudinary and CarrierWave
class AvatarUploader < CarrierWave::Uploader::Base
# include CarrierWave::RMagick
# configure do |config|
# config.remove_previously_stored_files_after_update = false
# end
include Cloudinary::CarrierWave
process :convert => 'jpg' #converts all images to pngs