Skip to content

Instantly share code, notes, and snippets.

View rikkipitt's full-sized avatar

Rikki Pitt rikkipitt

View GitHub Profile
@bnjamin
bnjamin / bare_transitions.js
Created June 23, 2020 10:28
Transitions stolen from alpine.js
export function transitionIn (el, show = () => {}) {
const attrs = getXAttrs(el, 'transition')
// If any transition attrs.
if (attrs.filter(attr => ['enter', 'enter-start', 'enter-end'].includes(attr.value)).length > 0) {
transitionClassesIn(el, attrs, show)
} else {
// If not, just show that damn thing.
show()
}
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active July 14, 2024 18:27
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install [email protected]
brew unlink [email protected]
brew link postgresql
@jwilson8767
jwilson8767 / es6-element-ready.js
Last active October 10, 2024 00:35
Wait for an element to exist. ES6, Promise, MutationObserver
// MIT Licensed
// Author: jwilson8767
/**
* Waits for an element satisfying selector to exist, then resolves promise with the element.
* Useful for resolving race conditions.
*
* @param selector
* @returns {Promise}
*/
@carlflor
carlflor / Gemfile-lock-fix.md
Created May 25, 2016 07:03
This fixes the Gemfile.lock conflict when doing git rebase

If both the upstream and your feature branch have made changes to Gemfile, you will likely receive merge conflicts on Gemfile.lock when you rebase your feature branch. Don't try to resolve these manually; you'll probably just screw it up. Instead do this:

    git checkout --ours Gemfile.lock
    bundle
    git add Gemfile.lock
    git rebase --continue

This ensures that you get a correct Gemfile.lock at each step along the way.

@rigelstpierre
rigelstpierre / spotify.rb
Created December 7, 2014 19:18
Spotify Auth
def spotify
self.validate_spotify_auth_token if self.spotify_auth_token.present?
config = {
:access_token => self.spotify_auth_token, # initialize the client with an access token to perform authenticated calls
:raise_errors => true, # choose between returning false or raising a proper exception when API calls fails
# Connection properties
:retries => 0, # automatically retry a certain number of times before returning
:read_timeout => 10, # set longer read_timeout, default is 10 seconds
:write_timeout => 10, # set longer write_timeout, default is 10 seconds
@hellosmithy
hellosmithy / .editorconfig
Created June 2, 2014 14:57
Default Editor Config
# http://editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
@hellosmithy
hellosmithy / SublimeText_Packages.md
Last active November 26, 2015 18:05
Useful SublimeText3 Packages
@gosseti
gosseti / form.html
Last active February 21, 2017 18:28
A credit card form using jQuery.payment
<form accept-charset="UTF-8" action="/payment" class="cardInfo" method="post">
<fieldset class="cardInfo__cardDetails">
<div class="form-row cardInfo__cc-num">
<label for="cc-num"><abbr title="required">*</abbr><span>Card Number</span></label>
<div class="cc-num__wrap">
<!-- using type="tel" because type="number" doesn’t pass HTML5 form validation with jQuery.payment formatting -->
<input id="cc-num" type="tel" class="paymentInput cc-num" placeholder="•••• •••• •••• ••••" autocompletetype="cc-number" required="required">
<span class="card" aria-hidden="true"></span>
@indiefolk
indiefolk / JS Revealing module pattern shortcut
Last active December 20, 2015 19:28
Sublime Snippet - JS Revealing Module pattern
<snippet>
<content><![CDATA[
/*
${1: Module Name}
*/
${2:Module} = (function () {
@micahroberson
micahroberson / estimate.rb
Created July 13, 2013 00:35
Generate and save a pdf to S3 with wicked_pdf and paperclip
# Main reference was lascarides' post at http://stackoverflow.com/questions/14743447/getting-pdf-from-wickedpdf-for-attachment-via-carrierwave
# estimate.rb
# ...
has_attached_file :pdf,
storage: :s3,
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['AWS_BUCKET']