Skip to content

Instantly share code, notes, and snippets.

View steveburkett's full-sized avatar

Steve Burkett steveburkett

View GitHub Profile
@steveburkett
steveburkett / gist:4583542
Last active October 28, 2019 16:31
Given an input N, print 'hello world' N times.
#include <iostream>
using namespace std;
int main() {
int i, n;
cin >> n;
for (i=0; i<n; i++) {
cout << "hello world\n";
}
return 0;
}
@steveburkett
steveburkett / step_1
Last active April 25, 2018 16:06
Stonecrop ReactJS basics
rails g model Part name:string description:text
rake db:migrate
017-03-28T18:37:12.826Z 20268 TID-oxi3cqvik INFO: Running in ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]
2017-03-28T18:37:12.826Z 20268 TID-oxi3cqvik INFO: Sidekiq Pro 3.4.5, commercially licensed. Thanks for your support!
2017-03-28T18:37:12.828Z 20268 TID-oxi3cqvik DEBUG: Client Middleware: Sidekiq::Batch::Client, SidekiqUniqueJobs::Client::Middleware
2017-03-28T18:37:12.828Z 20268 TID-oxi3cqvik DEBUG: Server Middleware: Sidekiq::Middleware::Server::Logging, Sidekiq::Middleware::Server::RetryJobs, Sidekiq::Middleware::Server::ActiveRecord, Sidekiq::Batch::Server, SidekiqUniqueJobs::Server::Middleware, Honeybadger::Plugins::Sidekiq::Middleware, NewRelic::SidekiqInstrumentation
2017-03-28T18:37:12.828Z 20268 TID-oxi3cqvik INFO: Starting processing, hit Ctrl-C to stop
2017-03-28T18:37:12.829Z 20268 TID-oxi3cqvik DEBUG: {:queues=>["default", "pentaho_job", "ruby_job"], :labels=>[], :concurrency=>10, :require=>".", :environment=>nil, :timeout=>8, :poll_interval_average=>nil, :average_scheduled_
@steveburkett
steveburkett / job1.rb
Last active March 26, 2017 22:04
sidekiq pro batch testing
class DwTestJob1
include Sidekiq::Worker
sidekiq_options queue: :default, retry: false
def perform(opts={})
puts('Starting Job1')
sleep(1.minute)
puts('Ending Job1')
end
end
@steveburkett
steveburkett / app.js.coffee
Created December 17, 2012 02:51
code to display Rails CRUD form in a jquery UI modal dialog. the rails code is nearly the same, except the ajax create call that removes the form. this just intercepts the submit and loads what rails sends back into the modal form.
#<%= link_to 'New Article', new_article_path, :id => 'create_article' %>
jQuery ->
$('#create_article').click( (e) ->
url = $(@).attr('href')
dialog_form = $('<div id="dialog-form">Firing up...</div>').dialog(
autoOpen: false
width: 520
modal: true
open: ->
Given:
Organization
has_one :plan, dependent: :destroy, inverse_of: :organization
validates_presence_of :name, :plan
Plan
belongs_to :organization, inverse_of: :plan
validates :organization, :type, presence: true
require "spec_helper"
module TimeZoneTestHelper
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
{
"debug_info" => [],
"html_attributions" => [],
"result" => {
"address_components" => [
[0] {
"long_name" => "Provo",
"short_name" => "Provo",
"types" => [
[0] "locality",
@steveburkett
steveburkett / google places detail API call
Last active December 21, 2015 21:38
Monterra Apartments 1333 N 24th St Phoenix, AZ 85008 Plus URL: https://plus.google.com/104682086520694271755/about?gl=US&hl=en-US
[15] pry(main)> details
{
"debug_info" => [],
"html_attributions" => [],
"result" => {
"address_components" => [
[0] {
"long_name" => "Monterra Apartments",
"short_name" => "Monterra Apartments",
"types" => [
class Middleware::Caring::Api
include HTTParty
#debug_output $stdout
base_uri 'dir.caring.com'
format :json
RESOURCE = '/api/v1/reviews/feed.json'
PID = 'fb0487e0'