Skip to content

Instantly share code, notes, and snippets.

View rposborne's full-sized avatar
💭
🍁

Russell Osborne rposborne

💭
🍁
View GitHub Profile
[
{
"name": "MEETING_ERROR_SUCCESS",
"error_code": 0,
"description": "Start meeting successfully."
},
{
"name": "MEETING_ERROR_INCORRECT_MEETING_NUMBER",
"error_code": 1,
"description": "The meeting number is wrong."
import os
from pathlib import Path
from gql import Client
from gql.transport.requests import RequestsHTTPTransport
# TO UPDATE
# gql-cli https://app-9377.on-aptible.com/graphql --print-schema >| schema.graphql
# prettier -w schema.graphql
@rposborne
rposborne / hangman.rb
Created November 4, 2016 02:11
Crash Course Hangman Solution
require './words'
puts "Hello, you are playing hangman!!!"
random_position = rand(@words.length)
selected_word = @words[random_position]
# selected_word = "moose"
lives = 7
guesses = []
@rposborne
rposborne / keybase.md
Created August 16, 2016 00:37
keybase.md

Keybase proof

I hereby claim:

  • I am rposborne on github.
  • I am rposborne (https://keybase.io/rposborne) on keybase.
  • I have a public key whose fingerprint is D3AA 5011 4EE1 A535 0008 371A 211E 632C 9FC5 23BF

To claim this, I am signing this object:

# frozen_string_literal: true
class ConvertJsonFieldsToJsonB < ActiveRecord::Migration
def change
reversible do |dir|
dir.up do
migrate_json_to_jsonb :table, :attribute
end
dir.down do
migrate_jsonb_to_json :table, :attribute
end
window.slow = false;
var slowLoad = window.setTimeout( function() {
window.slow = true;
}, 400 );
document.addEventListener('DOMContentLoaded', function() {
window.clearTimeout( slowLoad );
if (slow != true) {
@rposborne
rposborne / paperclip_rollback.rb
Last active November 12, 2015 19:08
Rollback Papertail with Block
# This utterly destroys your data, and does not attempt to put things back.
# BE WARNED
def roll_back_by_day(klass, start_at, end_at, &block)
# Turn off papertrail, we don't want our playback creating new versions.
klass.constantize.paper_trail_off!
# Play back on changes per day, at the last record on a day take snapshot
# using the block that was passed.
(end_at.to_date..start_at.to_date).reverse_each do |date|
query = PaperTrail::Version
@rposborne
rposborne / s3.rake
Created October 20, 2015 19:37
Spree Sync Production -> Local
# uploads assets to s3 under assets/githash, deletes stale assets
namespace :s3 do
task :download_paperclip_from_s3 do
mkdir_p './public/attachments/development/images/'
`s3cmd sync s3://#{ENV['PRODUCTION_S3_BUCKET_NAME']}/images/ ./public/attachments/development/images/ --acl-public >&2`
end
task :sync_images_to_staging do
mkdir_p './public/attachments/development/'
`s3cmd sync s3://#{ENV['PRODUCTION_S3_BUCKET_NAME']}/images/ s3://#{ENV['STAGING_S3_BUCKET_NAME']}/images/ --acl-public >&2`
@rposborne
rposborne / Repair Posterous
Created June 2, 2015 17:24
Repair Posterous Wordpress Export
Correct Timestamps and update images and links to images with a quick script from posterous wordpress export data.
Figured might be useful for someone.
worker: QUEUE=* bundle exec rake environment resque:work
scheduler: bundle exec rake environment resque:scheduler