Skip to content

Instantly share code, notes, and snippets.

View ibanez270dx's full-sized avatar
:shipit:
shippin' it

Jeff Miller ibanez270dx

:shipit:
shippin' it
View GitHub Profile
@ibanez270dx
ibanez270dx / copytable.sql
Last active August 29, 2015 14:11
Copying a table in MYSQL
CREATE TABLE tablename_backup LIKE tablename; INSERT tablename_backup SELECT * FROM tablename;
@ibanez270dx
ibanez270dx / gradient_generator.rb
Last active June 20, 2019 09:09
Ruby Gradient Generator
#####################################################################################
# gradient.rb 11.29.2014
#
# Ruby Gradient Generator
# author: Jeff Miller
# website: humani.se
# github: github.com/ibanez270dx
#
# USAGE:
# Enter RGB or Hex color values and number of steps
@ibanez270dx
ibanez270dx / merge_nested_hashes.rb
Last active August 29, 2015 13:58
Merge hashes inside a hash
hash = { one: { foo: 'bar', fizz: 'buzz' }, two: { whizz: 'bang', slap: 'stick' } }
result = {}
[:one, :two].each do |key|
result.merge!(hash[key])
end
result
@ibanez270dx
ibanez270dx / rtc_test_speech.html
Last active December 23, 2020 21:35
HTML5 Audio + Speech to Text...once you enable both microphone and voice recognition, say "facebook", "hack", or "what is my name"
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Web audio capture + Speech Recognition</title>
<link href="http://www.smartjava.org/examples/webaudio-filters/css/bootstrap.css" rel="stylesheet"/>
</head>
<body>
<div class="container">
<h1 class="pagination-centered">HTML5 Web audio capture + Speech Recognition</h1><br />
@ibanez270dx
ibanez270dx / example.html
Last active October 19, 2021 13:13
HTML5 Web Audio Example
<!DOCTYPE html>
<html>
<head>
<title>Web audio: Filter Playground</title>
<link href="http://www.smartjava.org/examples/webaudio-filters/css/bootstrap.css" rel="stylesheet"/>
</head>
<body>
<div class="container">
<h1 class="pagination-centered">HTML5 Web audio</h1>
@ibanez270dx
ibanez270dx / ConditionalValidations.rb
Last active April 10, 2018 11:31
A simple module that allows validation of only certain attributes of any given model. Created for CoverHound.com.
#
# At CoverHound, we use conditional validations all over the form. However, there is no proper way to do
# this in Rails. Instead, we can provide an array of attributes (validated_fields attribute)
# and ensure they are the only ones to get validated.
#
module ConditionalValidations
attr_accessor :validated_fields
def field_is_required?(field)