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
const fs = require('fs'); | |
const input = fs.readFileSync("./day-18/input.sample", "utf8").split("\n"); | |
function magnitude(num) { | |
if (typeof num === "number") return num; | |
const [left, right] = num; | |
return 3 * magnitude(left) + 2 * magnitude(right); | |
} |
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
export function loadSegment(writeKey) { | |
if (!writeKey) { | |
throw new Error("loadSegment: blank writeKey."); | |
} | |
var analytics = (window.analytics = window.analytics || []); | |
if (!analytics.initialize) | |
if (analytics.invoked) | |
window.console && | |
console.error && |
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
### Keybase proof | |
I hereby claim: | |
* I am ktusznio on github. | |
* I am ktusznio (https://keybase.io/ktusznio) on keybase. | |
* I have a public key ASA4KeJnQKl5ok63_6cNVA9r4R51CFiBzKJ8OErfoZvgawo | |
To claim this, I am signing this object: |
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
.hero { | |
background: url('/images/hero-mobile.jpg') no-repeat center center; | |
background-size: cover; | |
@include breakpoint(tablet) { | |
background-image: url('/images/hero.jpg'); | |
} | |
@include retina { | |
background-image: url('/images/[email protected]'); |
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
onSectionSubmit = (sectionConfig, options = {}) => { | |
var applicationData = this.props.applicationData; | |
if (!applicationData.isAuthenticated()) { | |
applicationData.fetch().done(data => { | |
var sectionConfigs = this.state.sectionConfigs; | |
sectionConfigs.push(this.getNextSectionConfig(sectionConfig)); | |
this.setState({sectionConfigs}); | |
this.scrollToLastSection(); | |
}); | |
return; |
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
var $ = require('jQuery'); | |
var _ = require('_'); | |
var React = require('react'); | |
var FinancingApplicationView = require('financing/views/FinancingApplicationView.react.jsx'); | |
var FinancingConstants = require('financing/FinancingConstants.js'); | |
var FinancingApplicationData = require('financing/models/FinancingApplicationData.js'); | |
var FinancingApplicant = require('financing/models/FinancingApplicant.js'); | |
var activeApplicant = new FinancingApplicant(); |
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
class LRUCache | |
MAX_SIZE = 3 | |
def initialize | |
@cache = {} | |
@max_size = MAX_SIZE | |
@lru_list = List.new | |
end | |
def get(key) |
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
def solution(strengths, weights, connections) | |
# simulate the order by going through the conections and building the graph | |
# at each step, evaluate the graph to detect breaks | |
# at each step, attach the weight, then travel up the graph and check for breaks O(n * log(n)) | |
# data structure: | |
# node(parent_node, strength, weight (incl. children), children) | |
# map(i: node) | |
# create root node |
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
class InFlip | |
initialize: (options) -> | |
@set 'stripe_token', new Threadflip.StripeToken(options.stripeToken) | |
fetchStripeToken: -> | |
@get('stripe_token').fetch() |
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
class BaseView extends Backbone.View | |
template: "" | |
# Render hooks. | |
beforeFirstRender: -> | |
beforeRender: -> | |
afterRender: -> | |
afterFirstRender: -> | |
render: => |
NewerOlder