Skip to content

Instantly share code, notes, and snippets.

View jonathanmeaney's full-sized avatar

Jonathan Meaney jonathanmeaney

View GitHub Profile
@jonathanmeaney
jonathanmeaney / Google Books Search.js
Created December 9, 2011 20:05
Using google books rest api to search for books
<script>
function view_books()
{
$.getJSON('https://www.googleapis.com/books/v1/volumes?q=food+allergies&maxResults=5', function(data) {
var items = [];
$.each(data, function(key, val) {
items.push('<li id="' + key + '">' + val + '</li>');
});
@jonathanmeaney
jonathanmeaney / calc-mate.conf
Created January 16, 2021 13:37
calc-mate Nginx server config
server {
server_name calc-mate.com www.calc-mate.com;
root /path/to/calc-mate/build;
index index.html;
location / {
try_files $uri /index.html;
}
}
@jonathanmeaney
jonathanmeaney / sketch.js
Last active August 8, 2020 20:12
Seven segment display clock
let digitHour0, digitHour1, digitMinute0, digitMinute1, digitSecond0, digitSecond1;
let colon1, colon2;
function setup() {
createCanvas(395, 110);
}
function draw() {
background(51);
@jonathanmeaney
jonathanmeaney / generate_lock_version_migrations.rb
Last active July 27, 2020 19:23
Iterate a list of table names and generate a migration file to add the lock_version column to each
[].each do |table|
time = Time.now.strftime("%Y%m%d%H%M%S")
filename = "#{time}_add_lock_version_to_#{table}.rb"
File.open(filename, 'w') do |file|
file.puts("class AddLockVersionTo#{table.camelize} < ActiveRecord::Migration[5.2]")
file.puts(" def change")
file.puts(" add_column :#{table}, :lock_version, :integer, default: 0")
file.puts(" end")
file.puts("end")
end