Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@mrtony
mrtony / react_formik_yup_checkbox_validation.md
Created October 15, 2018 01:31
React formik yup checkbox, radio button validation
import "./formik-demo.css";
import React from "react";
import { render } from "react-dom";
import { Formik, Field } from "formik";
import Yup from "yup";
import classNames from "classnames";

// Input feedback
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@olexpono
olexpono / Custom.css
Last active February 14, 2023 15:44
Crate -- a Dark gray/orange Theme for Chrome DevTools
/**********************************************/
/*
/*
/* Crate -- Theme for Chrome DevTools
/* Last Update :: September 2013
/*
/* based on:
/* mnml by Michael P. Pfeiffer
/* Based on a Gist by Ben Truyman. Further attr:
/* https://gist.github.com/3040634
@gshaw
gshaw / carrier_wave.rb
Created August 14, 2014 19:06
CarrierWave initialization file for testing with fixtures and support S3 in staging and production.
# NullStorage provider for CarrierWave for use in tests. Doesn't actually
# upload or store files but allows test to pass as if files were stored and
# the use of fixtures.
class NullStorage
attr_reader :uploader
def initialize(uploader)
@uploader = uploader
end
"use strict";
function jsonToSassVars (obj, indent) {
// Make object root properties into sass variables
var sass = "";
for (var key in obj) {
sass += "$" + key + ":" + JSON.stringify(obj[key], null, indent) + ";\n";
}
// Store string values (so they remain unaffected)
@schinckel
schinckel / jquery.couch.longpoll.js
Created January 22, 2012 11:29
Long-polling handler for CouchDB
/*
# jquery.couch.longpoll.js #
A handler that can be used to listen to changes from a CouchDB database,
using long-polling.
This seemed to be a bit simpler than using continuous polling, which I
was unable to get working with jQuery.
@elucas
elucas / gist:5056751
Last active December 14, 2015 08:19
This is the Ajax form submission -> content update code that reaffirmed my Man-Crush on Ben.

When you submit the form#filters_form, it requests the response in the background, replaces the existing contents of #article_blocks with the #article_blocks from the response, and updates the url with the params given.

Oh, and if it fails, it redirects you to the form url, so that you're not left in a broken ajax state.

So:

  • No fancy ajax logic server-side
  • No fancy ajax logic client-side
  • Just the bit of content you wanted gets updated

Disclaimer: Tweaks would be needed for POST forms

@pads
pads / bot.js
Created November 28, 2014 09:17
BrumJS Rock Paper Scissors Bot
var hands = [
'rock',
'paper',
'scissors',
'water',
'dynamite'
];
var opponents = []
@joonty
joonty / unicorn
Created May 30, 2014 12:58
Unicorn service script
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage unicorn server
# Description: Start, stop, restart unicorn server for a specific application.
### END INIT INFO
@olorton
olorton / provision
Created May 19, 2014 13:39
Anisble provision script
#!/bin/bash
while getopts "v:" OPTION; do
case $OPTION in
v) shift; verbose=true;;
# Unknown option. No need for an error, getopts informs
# the user itself.
\?) exit 1;;
esac
done