Skip to content

Instantly share code, notes, and snippets.

View RobertKim's full-sized avatar

Robert Kim RobertKim

View GitHub Profile
@RobertKim
RobertKim / email_account_creator.rb
Created July 11, 2022 07:58
Code sample - connection to Google Cloud Platform API for Adming directory user creation
require 'google/apis/admin_directory_v1'
require 'googleauth'
module GoogleIntegration
class EmailAccountCreator
def initialize(account)
@account = account
end
def call
@RobertKim
RobertKim / ppay_ledger.rb
Last active October 31, 2016 23:21
Evaluation exercise for ProducePay
#!/usr/bin/ruby
ALL_TRANSACTIONS = []
ALL_CUSTOMERS = []
class Transaction
attr_accessor :id, :customer_id, :description, :amount, :timestamp, :printable_time
def initialize(customer_id, description, amount)
@timestamp = Time.now
@printable_time = @timestamp.strftime("%m/%d/%Y | %H:%M:%S")
@id = Time.now.strftime("%m%d%Y%H%M%S")
@RobertKim
RobertKim / rankings_projects.rake
Created October 25, 2016 16:34
Rake tasks for mass creation of project records for AWR Cloud with their API, in sync with local database project records.
require 'salesforce_parc'
namespace :rankings do
desc ""
task :create_all_projects => :environment do
begin
AwrcloudApiCall.if_free_calls -> do
puts "Started creating rankings projects... #{Time.now}"
api = RubyTrac::API.new Rails.application.secrets.leadtrac_username, Rails.application.secrets.leadtrac_password
leadtrac_numbers = api.soap(:search_by_status, {statusId: 13026}).body[:search_by_status_response][:search_by_status_result][:string]
@RobertKim
RobertKim / user.rb
Created October 25, 2016 16:27
User model class for Rails application consuming Salesforce CRM API through databasedotcom gem (client-facing app used to show personal website SEO performance and analytics)
require 'rubytrac'
require 'bcrypt'
require 'net/http'
require 'uri'
require 'salesforce_parc'
require "base64"
class User < ActiveRecord::Base
has_many :logs, as: :loggable
has_many :events
@RobertKim
RobertKim / rankings_api.rb
Last active October 25, 2016 16:24
Module used to consume AWR Cloud API (for processing domain name rankings on various search engines)
module RankingsAPI
NoDateError = Class.new(StandardError)
NoRankingError = Class.new(StandardError)
ProjectExistsError = Class.new(StandardError)
def self.get_latest_rankings(project, api=nil)
api = api || AWRCloud::API.new(project.awr_account.token)
project.update got_rankings_at: Time.now
date = get_latest_ranking_report_date project, api
ranking_data = get_ranking project, date, api
class Car
@@WHEELS = 4
def initialize(args)
@color = args[:color]
@wheels = @@WHEELS
end
def drive
@status = :driving
end
def brake
@RobertKim
RobertKim / index.html
Created May 28, 2013 20:45 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@RobertKim
RobertKim / index.html
Last active December 17, 2015 18:19 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@RobertKim
RobertKim / index.html
Created May 26, 2013 08:22 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@RobertKim
RobertKim / zoo.js
Last active December 17, 2015 16:19 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
var Zoo = {
init: function(animals) {
this.animals = animals
};
biped : function() {
var bipeds = [];