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
package main | |
import "fmt" | |
/* | |
Return all permutations of a string | |
Example, | |
Find all perm of abc: |
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
Before pasting | |
:set paste | |
After Paste | |
:set nopaste |
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
+web: | |
+ build: . | |
+ ports: | |
+ - '9292:9292' | |
+ volumes: | |
+ - '.:/var/app' | |
+ tty: true | |
+ command: ["rerun", "--force-polling", "foreman", "start"] |
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
FROM ruby:2.2.0 | |
RUN mkdir -p /var/app | |
COPY Gemfile* /var/app/ | |
WORKDIR /var/app | |
ENV environment=development | |
RUN bundle install |
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
./script/scraper --help | |
Usage: scraper [options] [sources ...] | |
Specific Options: | |
-l, --limit N Limit operations to N listings. | |
-t, --throttle N Random amount of time to throttle between url gets. | |
-c, --command [COMMAND] Which types of scraping command you want to run (all harvest collect scrape rescrape all_agents new_agents fix_agents quick_harvest_and_close quick_close validate) | |
-s, --sourceid id Scrapes a single listing using its source id. | |
-o, --office office_key(s) Scrapes office's listings using its office key (for MRIS and ListHub scrapers). Can be comma-delimited. | |
-e, --env [ENVIRONMENT] Which types of evironment you want to run in (prod gamma beta dev) |
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
u = User.find 1 | |
// page 1 | |
c1 = u.comments.where(disabled: 0).limit(50).page(1).per(20) | |
id1 = c1.map(&:id) | |
//page2 | |
c2 = u.comments.where(disabled: 0).limit(50).page(2).per(20) | |
id2 = c2.map(&:id) |
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 addToTree = function() { | |
input = document.getElementById('tree-input'); | |
value = parseInt(input.value); | |
if(value) | |
btree.add(value); | |
else | |
alert("Wrong input"); | |
}; |
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
// Represents the btree logic | |
var BTree = function() { | |
var c = document.getElementById('my-canvas'); | |
var ctx = c.getContext('2d'); | |
var line = new Line(); | |
this.root = null; | |
var self = this; | |
// Getter for root |
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
// Draws a line from one circle(node) to another circle (node) | |
var Line = function() { | |
// Takes | |
// x,y - starting x,y coordinate | |
// toX, toY - ending x,y coordinate | |
this.draw = function(x, y, toX, toY, r, ctx) { | |
var moveToX = x; | |
var moveToY = y + r; | |
var lineToX = toX; | |
var lineToY = toY - r; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
.center {margin: auto; width: 50%;} | |
<style> | |
</head> | |
<body> | |
<div class='input-box'> | |
<input id='tree-input' type='number' placeholder='Enter number'> |
NewerOlder