Skip to content

Instantly share code, notes, and snippets.

View zachhale's full-sized avatar
🚴‍♂️
Riding my bike

Zach Hale zachhale

🚴‍♂️
Riding my bike
View GitHub Profile
@jaredpalmer
jaredpalmer / Formik-Autosave.jsx
Last active December 29, 2022 01:22
Formik-Autosave
import React from 'react';
import PropTypes from 'prop-types'
import debounce from 'lodash.debounce' // or whatevs
import isEqual from 'lodash.isEqual'
class AutoSave extends React.Component {
static contextTypes = {
formik: PropTypes.object
}
@mairh
mairh / Redux-Form-Semantic-UI-React
Last active August 12, 2021 23:03
Semantic-UI-React form validation using redux-form example
// semantic-ui-form.js
import React from 'react';
import PropTypes from 'prop-types';
import { Form, Input } from 'semantic-ui-react';
export default function semanticFormField ({ input, type, label, placeholder, meta: { touched, error, warning }, as: As = Input, ...props }) {
function handleChange (e, { value }) {
return input.onChange(value);
}
@estrattonbailey
estrattonbailey / react-shortcodes.js
Last active October 8, 2018 23:47
React Shortcodes
import React from 'react'
import { renderToString } from 'react-dom/server'
import parser from './shortcode-parser'
export const add = parser.add
const Aside = ({ children, config }) => {
/**
* config = {
* foo: true,
CREATE OR REPLACE FUNCTION generate_object_id() RETURNS varchar AS $$
DECLARE
time_component bigint;
machine_id int := FLOOR(random() * 16777215);
process_id int;
seq_id bigint := FLOOR(random() * 16777215);
result varchar:= '';
BEGIN
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp())) INTO time_component;
SELECT pg_backend_pid() INTO process_id;
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@quicklywilliam
quicklywilliam / gist:95a8b6a4f8b274b6d775
Last active June 29, 2022 16:39
Craigslist search query for finding classic steel touring bikes
**Tourers (CL appears to have a max query length so you now need to run this search in two parts)**
Part 1:
tourismo|Specialissima|520|620|720|Expedition|Sequoia|Voyageur|Passage|Portage|Alyeska
Part 2:
Kodiak|Panasonic|Nishiki|Miyata|Bridgestone|waterford|tour|tourer|touring
**Mountain Bikes**
stumpjumper|cascade|mb|Highpath|Overbury|ritchey
@killercup
killercup / mongoose-csv-stream-export.js
Created January 21, 2014 10:58
Stream data from Mongoose into CSV download
var Campaign = require('../model/campaign');
module.exports.getCampaignsCSV = function (req, res) {
function CSVEscape(field) {
return '"' + String(field || "").replace(/\"/g, '""') + '"';
}
var headers = [
'Code-Nummer', //num
'Kampagnenname', //name
@jamarparris
jamarparris / Generate Mongo Object ID in PostGres
Last active March 20, 2024 00:04
Create ObjectIds in PostGres following the MongoDB semantics. Very similar to the Instagram approach linked below.http://docs.mongodb.org/manual/reference/object-id/http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram
The MIT License (MIT)
Copyright (c) 2013 Jamar Parris
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@monde
monde / honeybadger_resque.rb
Created August 4, 2012 05:09
Honeybadger based error reporting backend for Resque
# for Rails place in config/initializers/honeybadger_resque.rb
%w( resque honeybadger ).each do |gem|
begin
require gem
rescue LoadError
raise "Can't find '#{gem}' gem. Please add it to your Gemfile or install it."
end
end
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];