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 ruby | |
# frozen_string_literal: true | |
require 'pathname' | |
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', | |
Pathname.new(__FILE__).realpath) | |
require 'rubygems' | |
require 'bundler/setup' | |
require_relative '../config/boot' |
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 insertionSort = (input) => { | |
let data = input.slice() | |
for(var i = 1; i < data.length; i++) { | |
for(var j = i; j > 0; j--) { | |
if(data[j] < data[j - 1]) { exchange(data, j - 1, j) } else { break } | |
} | |
} | |
return data; | |
} |
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 selectionSort = (input) => { | |
let data = input.slice() | |
for(var i = 0; i < data.length; i++) { | |
var lower = i | |
for(var j = i + 1; j < data.length; j++) { | |
if(data[lower] > data[j]) lower = j | |
} | |
exchange(data, i, lower) | |
} |
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 bubbleSort = (input) => { | |
let data = input.slice() | |
for(var i = 0; i < data.length; i++) { | |
for(var j = 1; j < data.length - i; j++) { | |
if(data[j - 1] > data[j]) exchange(data, j - 1, j) | |
} | |
} | |
return data | |
} |
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
import jsdom from 'jsdom' | |
import chai from 'chai' | |
import chaiSpies from 'chai-spies' | |
import chaiSubset from 'chai-subset' | |
import chaiAsPromised from 'chai-as-promised' | |
const doc = jsdom.jsdom('<!doctype html><html><body></body></html>') | |
const win = doc.defaultView | |
const localStorage = { | |
getItem: function (attr) { |
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 Circle(x, y, r) { | |
this.x = x | |
this.y = y | |
this.r = r | |
} | |
Circle.prototype.draw = function(canvas) { | |
console.log('circle of radius', this.r, 'draw with', 'x', this.x, 'y', this.y, 'position') | |
} |
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 User() { | |
this.subscribers = [] | |
} | |
User.prototype.subscribe = function(subscriber) { | |
this.subscribers.push(subscriber) | |
} | |
User.prototype.unsubscribe = function(subscriber) { | |
this.subscribers = this.subscribers.filter((item) => { |
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 ramzesucr on github. | |
* I am ramzesucr (https://keybase.io/ramzesucr) on keybase. | |
* I have a public key whose fingerprint is A0FB 9747 E2B4 AB1F 8664 74D8 3E3A 599E 7216 94E8 | |
To claim this, I am signing this object: |