Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Meaney jonathanmeaney

View GitHub Profile
@jonathanmeaney
jonathanmeaney / Google Books Search.js
Created Dec 9, 2011
Using google books rest api to search for books
View Google Books Search.js
<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 / generate_lock_version_migrations.rb
Last active Jul 27, 2020
Iterate a list of table names and generate a migration file to add the lock_version column to each
View generate_lock_version_migrations.rb
[].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
@jonathanmeaney
jonathanmeaney / sketch.js
Last active Aug 8, 2020
Seven segment display clock
View sketch.js
let digitHour0, digitHour1, digitMinute0, digitMinute1, digitSecond0, digitSecond1;
let colon1, colon2;
function setup() {
createCanvas(395, 110);
}
function draw() {
background(51);
@jonathanmeaney
jonathanmeaney / calc-mate.conf
Created Jan 16, 2021
calc-mate Nginx server config
View calc-mate.conf
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;
}
}