Skip to content

Instantly share code, notes, and snippets.

require 'csv'
namespace :csv do
desc "generates a migration file from column names from the CSV headers"
task create_migration: :environment do
def headers_from_CSV (filename)
csv_header_array = CSV.read(filename, headers: true).headers
return csv_header_array.map { |col_a| col_a.strip.downcase.gsub(' ', '_').gsub('.', '_') }
end
@roberthopman
roberthopman / wip_graphql_demo.rb
Created October 25, 2018 13:36 — forked from skatkov/wip_graphql_demo.rb
Ruby example of creating a todo and then completing it using wip.chat graphql.
# NOTE: Be sure to set the API key further down in the code!
require "net/http"
require "uri"
require "json"
class WIP
def initialize(api_key:)
@api_key = api_key
end
require 'pp'
require 'upwork/api'
# require 'upwork/api/routers/auth'
# require 'upwork/api/routers/organization/users'
require 'upwork/api/routers/jobs/search'
# step 1
config = Upwork::Api::Config.new({
'consumer_key' => 'x',
'consumer_secret' => 'x',