This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...] | |
if Rails.env == "staging" | |
require "#{Rails.root}/lib/staging_exception_handler.rb" | |
config.middleware.use StagingExceptionHandler | |
end | |
[...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Foo has_one :bar, Bar belongs_to :foo | |
# Foo has_one parent_foo and has_many child_foos | |
# Bar has_one parent_foo through :foo | |
# Bar has_one parent_bar through :parent_foo | |
# | |
# The parent_bar association incorrectly applies values into the SQL query | |
# You can see this in the query generated from b1.parent_bar in the code below: notice there are 3 "?"s and 2 node values. | |
# SELECT "bars".* FROM "bars" INNER JOIN "foos" ON "bars"."foo_id" = "foos"."id" INNER JOIN "foo_relationships" ON "foos"."id" = "foo_relationships"."parent_foo_id" INNER JOIN "foos" "foos_parent_bar_join" ON "foo_relationships"."child_foo_id" = "foos_parent_bar_join"."id" WHERE "bars"."deleted" = ? AND "foos"."deleted" = ? AND "foos_parent_bar_join"."id" = ? LIMIT 1 [["deleted", "f"], ["id", 2] | |
# | |
# This is more noticeable when using MySQL, as it is less forgiving of missing nodes: notice that the id of '2' is being applied to `foos`.`deleted`, and final value for `foos_parent_bar_join`.`id` in the query string is simply missing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stringio' | |
class CaptureStdout | |
def initialize(&blk) | |
@handler = blk | |
end | |
def capture | |
StringIO.open do |io| | |
stash = $stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'stringio' | |
class CaptureStdout | |
def initialize(&blk) | |
@handler = blk | |
end | |
def capture | |
StringIO.open do |io| | |
stash = $stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Graph2(canvas) { | |
if (canvas.tagName !== 'CANVAS') { throw 'Graph2 requires a canvas element'; } | |
this.canvas = canvas; | |
this.cursor = canvas.getContext("2d"); | |
this.axes = { | |
display: false, | |
xlim: [-1, 1], | |
ylim: [-1, 1], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ensure that you have your iTerm configured to allow the shell to modify the window / tab title. | |
# In iTerm 3.1.2 this is a checkbox located in Settings > Profile > Terminal: "Terminal may set tab/window title" | |
# Then, put this in your .bash_profile | |
if [ $ITERM_SESSION_ID ]; then | |
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND"; | |
fi | |
# Piece-by-Piece Explanation: | |
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment | |
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
Introduction: | |
This coding challenge is designed for you to show off your skills to the 3Play Media Developer team. You | |
should have the following challenge completed by the time you come in for your in-person interview so we | |
can take a look at it together. While all of the basic requirements of this project should be met, you're | |
encouraged to make this project your own and implement any additional features that you see fit. | |
Feel free to ask whatever questions, use whatever resources and provide whatever documentation | |
you'd like during the completion of this project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function KeyPress(e) { | |
var evtobj = window.event? event : e | |
if (evtobj.keyCode == 90) { | |
window.scrollBy(0, 100) | |
} | |
if (evtobj.keyCode == 65) { | |
window.scrollBy(0, -100) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source colors.sh | |
bash_colors | |
source gitbranch.sh | |
PS1='[\[$(git_branch_color)\]$(parse_git_branch)\[${NORMAL}\]] '"$PS1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# In[1]: | |
# import libraries | |
import boto3, re, sys, math, json, os, sagemaker, urllib.request | |
from sagemaker import get_execution_role | |
import numpy as np |
OlderNewer