Skip to content

Instantly share code, notes, and snippets.

View ArionHardison's full-sized avatar
🏠
Working from home

HIM ArionHardison

🏠
Working from home
  • Hardison Co.
  • Los Angeles, CA
  • 06:24 (UTC -12:00)
View GitHub Profile
@ArionHardison
ArionHardison / standup-20250218.md
Created February 18, 2025 22:10
standup-20250218

Standup - 2025-02-18

Yesterday:

  • Holiday
    • Presidents Day

Today:

@ArionHardison
ArionHardison / abba-babba.md
Last active February 13, 2020 12:57 — forked from pixelcandy/abba-babba.md
Brief Ruby Challenge

Instructions

  • Fork this gist.
  • Please complete the quick challenge below using Ruby, uploading additional files if necessary.
  • Reply back to the email you were sent with the link to your completed gist.

Abba Babba Binary Challenge

def objective_function(vector)
return vector.inject(0) {|sum, x| sum + (x ** 2.0)}
end
def rand_in_bounds(min, max)
return min + ((max-min) * rand())
end
def random_vector(minmax)
return Array.new(minmax.size) do |i|
x = {
blog_post: {
name: "You will nevtrhtytrer guess",
slug: "pudgfdfdfddfgfdgfdzzle",
status: "published",
content_before_flip: "<p>You will never guess what is after the flip</p>",
content_after_flip: "<p>The answer is words. Words were after the flip.</p>",
tags: ["funny", "true"],
published_at: "2013-04-25T10:47:06-07:00"
}
Completed 200 OK in 3ms (ActiveRecord: 1.5ms)
DEBUG [7726bec1] I, [2015-09-22T15:57:13.661867 #17769] INFO -- : Started POST "/api/v1/user/checkin" for 172.56.31.221 at 2015-09-22 15:57:13 +0000
DEBUG [7726bec1] I, [2015-09-22T15:57:13.663523 #17769] INFO -- : Processing by API::V1::UsersController#checkin as JSON
DEBUG [7726bec1] I, [2015-09-22T15:57:13.663591 #17769] INFO -- : Parameters: {"lat"=>"34.0490527265091", "lon"=>"-118.2498243917881", "subdomain"=>"api"}
DEBUG [7726bec1] D, [2015-09-22T15:57:13.664649 #17769] DEBUG -- : User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."uid" = $1 LIMIT 1 [["uid", "[email protected]"]]
DEBUG [7726bec1] D, [2015-09-22T15:57:13.738442 #17769] DEBUG -- : Location Load (0.6ms) SELECT "locations".* FROM "locations" WHERE "locations"."user_id" = $1 LIMIT 1 [["user_id", 126]]
DEBUG [7726bec1] D, [2015-09-22T15:57:13.739216 #17769] DEBUG -- : (0.4ms) BEGIN
DEBUG [7726bec1] D, [2015-09-22T15:57:13.740959 #177
{
"data" : {
"bark_date" : {
"park" : {
"address" : {
"city" : "Los Angeles",
"postal_code" : null,
"longitude" : -118.2670922,
"street_2" : null,
"street_1" : "1850 W. Silver Lake Drive 90026",
User Load (1.5ms) SELECT "users".* FROM "users" WHERE "users"."uid" = $1 LIMIT 1 [["uid", "[email protected]"]]
DEBUG [86302d37] D, [2015-09-09T16:49:32.121083 #11040] DEBUG -- : Dog Load (0.6ms) SELECT "dogs".* FROM "dogs" WHERE "dogs"."user_id" = $1 AND "dogs"."id" = $2 LIMIT 1 [["user_id", 119], ["id", 80]]
DEBUG [86302d37] D, [2015-09-09T16:49:32.123300 #11040] DEBUG -- : (0.4ms) BEGIN
DEBUG [86302d37] D, [2015-09-09T16:49:32.124568 #11040] DEBUG -- : Park Load (0.6ms) SELECT "parks".* FROM "parks" WHERE "parks"."id" = $1 LIMIT 1 [["id", 46]]
DEBUG [86302d37] D, [2015-09-09T16:49:32.126335 #11040] DEBUG -- : SQL (0.6ms) INSERT INTO "bark_dates" ("starts_at", "park_id", "dog_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["starts_at", "2015-09-09 05:03:35.839912"], ["park_id", 46], ["dog_id", 80], ["created_at", "2015-09-09 16:49:32.125112"], ["updated_at", "2015-09-09 16:49:32.125112"]]
DEBUG [86302d37] D, [2015-09-09T16:49
# the graphs in this case are represented by their adjacency matrix (see below),
# where graph[i][j] == 1 if there is an edge between nodes
#todo - try and implement as breadth first or at least figure out which would be bettter
lbl = %w(Good OK Better Meh Worse Not_OK Bad)
graph = [0,1,1,0,0,1,0,0,0,1], # Good
[1,0,0,0,0,0,0,1,1,0],
[0,0,0,0,0,0,0,0,0,0],
<?php
require('PHP-OAuth2/src/OAuth2/Client.php');
require('PHP-OAuth2/src/OAuth2/GrantType/IGrantType.php');
require('PHP-OAuth2/src/OAuth2/GrantType/AuthorizationCode.php');
$clientId = '9b8b0e1fe97d8efb3cb634ea65c03c8de269121894b980b1935db889aac11634';
$clientSecret = 'afc5c60f67b00443d858efb9226b71da3a64873764ae4acf7d4a8cfc43cff91c';
$client = new OAuth2\Client($clientId, $clientSecret);
// http://en.wikipedia.org/wiki/Merge_sort
let rec mergeSort (arr : 'a []) =
let split (arr : _ array) =
let n = arr.Length
arr.[0..n/2-1], arr.[n/2..n-1]
let rec merge (l : 'a array) (r : 'a array) =
let n = l.Length + r.Length
let res = Array.zeroCreate<'a> n
let mutable i, j = 0, 0