All of the commands that start with '$' should be done in the terminal with out the '$' part.
As an example when you see:
$rails c
You should type
rails c
import { comments } from "./mock-response.json"; | |
const mockResponse = (response) => { | |
return new Promise((resolve) => { | |
setTimeout(() => { | |
resolve({ | |
success: 200, | |
json: () => | |
new Promise((resolve) => { | |
return resolve(response); |
const fs = require('fs'); | |
let words = fs.readFileSync('/usr/share/dict/words', 'utf8') | |
.split('\n'); | |
let board = [ | |
'moronqisioteqwo', | |
'gdouchebagopzay', | |
'frnvfkttdnjddsk', | |
'eawtcolcaeoksru', | |
'lsiiwamchnwurcg', | |
'isddraecyipdjoa', |
class SudokuSolver { | |
constructor(board) { | |
this.board = board; | |
} | |
solve() { | |
const index = this.board.indexOf('0'); | |
if (index === -1) return this.board; | |
for (let possibility = 1; possibility < 10; possibility++) { |
require 'date' | |
def random_date_between(args) | |
start, finish = args[:start], args[:finish] | |
start, finish = [start, finish].map do |datetime| | |
case | |
when datetime.is_a?(DateTime) then datetime.to_time.to_i | |
when datetime.is_a?(Date) then DateTime.parse(datetime.to_s).to_time.to_i | |
when datetime.is_a?(String) then DateTime.parse(datetime).to_time.to_i | |
else |
def karatsuba x, y | |
return x * y if (x < 10) || (y < 10) | |
n = [x.to_s.size, y.to_s.size].max | |
n2 = n/2 | |
a, b = x.divmod(10**n2) | |
c, d = y.divmod(10**n2) | |
step_1 = karatsuba(a,c) | |
step_2 = karatsuba(b,d) |
# From | |
# | |
# $*.map{|a|(i=a=~/0/)?(v=*?1..?9).fill{|j|v-=[a[j+i-k=i%9],a[ | |
# k+j*=9],a[j%26+i-i%3-i%27+k]]}+v.map{|k|$*<<$`+k+$'}:p(a)} | |
# | |
# | |
# To | |
start = Time.now | |
counter = 1 |
def merge_sort(ary) | |
size = ary.size | |
return ary if size <= 1 | |
mid = size/2 | |
left, right = ary[0..mid-1], ary[mid..-1] | |
left, right = merge_sort(left), merge_sort(right) | |
merge(left, right) |
def karatsuba(x, y) | |
return x * y if (x < 10) || (y < 10) | |
n = [x.to_s.size, y.to_s.size].max | |
n2 = n/2 | |
a, b = x.divmod(10**n2) | |
c, d = y.divmod(10**n2) | |
step_1 = karatsuba(a,c) | |
step_2 = karatsuba(b,d) |
All of the commands that start with '$' should be done in the terminal with out the '$' part.
As an example when you see:
$rails c
You should type
rails c
# From | |
# | |
# $*.map{|a|(i=a=~/0/)?(v=*?1..?9).fill{|j|v-=[a[j+i-k=i%9],a[ | |
# k+j*=9],a[j%26+i-i%3-i%27+k]]}+v.map{|k|$*.<<$`<<k<<$'}:p(a)} | |
# | |
# | |
# To | |
start = Time.now | |
ARGV.map do |board| |