Skip to content

Instantly share code, notes, and snippets.

!function () {
var analytics = window.analytics = window.analytics || [];
if (!analytics.initialize) if (analytics.invoked) window.console && console.error && console.error("Segment snippet included twice.");
else {
analytics.invoked = !0;
analytics.methods = ["trackSubmit", "trackClick", "trackLink", "trackForm", "pageview", "identify", "reset", "group", "track", "ready", "alias", "debug", "page", "once", "off", "on"];
analytics.factory = function (t) {
return function () {
var e = Array.prototype.slice.call(arguments);

Review and Test PR's on Heroku Review Apps

As the result of exploring Heroku review apps we came up with an experiment to run this sprint:

  • We'll spin up review apps manually from PR's that you can find on sapling's deploy dashboard on Heroku
  • Heroku has this name convention for the apps https://hipcamp-sapling-pr-1920.herokuapp.com
  • Review apps will be destroy automatically once the PR has been merged
  • Please don't leave review apps alive if not necessary, will pay for them by the second
  • We should stop using slack bot to deploy to sapling or sapling and run this experiment
  • We should share the URL on Trello cards. I'm going to look into the bot and see if I can add them automatically
  1. Stop your existing postgres, redis and elasticsearch services and make sure they dont start on start-up . 1.a. List of services: brew services list . 1.b. Stop services: brew services stop <name> . 1.c. Remove from load: launchctl remove <name> .
  2. Download Docker for Mac
  3. Create a Docker Hub account if you don’t already have one. After logging in, remember your user-id which will be displayed in the top right corner. Mine is jeckstein
  4. Login to docker via the cli: docker login from the project root.
  5. Then docker-compose up from the project root. This will initialize all environments which should result in an empty postgres db, es index and redis cache.
  6. Run the rake tasks to re-constitute your data:
@sebabelmar
sebabelmar / repos.sh
Created January 15, 2018 21:50
Script to download repos
Generic script:
for i in `curl -u [GH_USERNAME:GH_TOKEN] -s "https://api.github.com/orgs/[COHORT_NAME]/repos…[page number start with 1]" |grep ssh_url | cut -d ':' -f 2-3|tr -d '",'`; do git clone $i; done
Example for 2 pages:
for i in `curl -u sebabelmar:456banana7845678 -s "https://api.github.com/orgs/fence-lizards-2014/repos…" |grep ssh_url | cut -d ':' -f 2-3|tr -d '",'`; do git clone $i; done
for i in `curl -u sebabelmar:456banana7845678 -s "https://api.github.com/orgs/fence-lizard-2014/repos…" |grep ssh_url | cut -d ':' -f 2-3|tr -d '",'`; do git clone $i; done
@sebabelmar
sebabelmar / es5-function-this.js
Last active November 27, 2017 18:52
This as returning value of a function invoked in 4 different ways - traditional functions
// ########## Tradictional Functions ##########
// ########## this bound ##########
// 1.
let bFunc = function() {
return this
}
// 2.
let obj = {}
@sebabelmar
sebabelmar / es6-arrow-functions-this.js
Last active November 27, 2017 18:39
ES6 Arrow Functions - this
// ########## ES6 Arrow Functions ################
// ########## this no longer bound ################
// Note: when running the code on an fat-arrow-enabled runtime
// 1.
let aFunc = ()=>{
return this
}
// 2.
@sebabelmar
sebabelmar / Q2-Classes.md
Created July 4, 2017 22:38
Clarks Questions

Question #2:

What is the difference between the following :

.class-a.class-b
.class-c .class-d
.class-e > .class-f
.class-g + .class-h
.class-i - .class-j
/*============================================================================
Dependency-free breakpoint mixin
- http://blog.grayghostvisuals.com/sass/sass-media-query-mixin/
==============================================================================*/
$min: min-width;
$max: max-width;
@mixin at-query ($constraint, $viewport1, $viewport2:null) {
@if $constraint == $min {
@media screen and ($min: $viewport1) {
// ----------------------- Driver Code -----------------------
var b1 = {brand: "scott", year: 2016, color: "red"}
var b2 = {brand: "specialized", year: 2016, color: "blue"}
var b3 = {brand: "Releigh", year: 2016, color: "white"}
arr = Bike.create_bikes_array([b1, b2, b3])
console.log(arr); // => [< Instance of Bike 1>, <Instance of Bike 2>, <Instance of Bike 3>]
//Stretch print: ["scott", "specialized", "Releigh"]
@sebabelmar
sebabelmar / ruby_closures.rb
Created September 24, 2016 01:56
Thoughts on Ruby Closures
# outer = 1
# def m
# inner = 99
# puts "inner var = #{inner + outer}" # outer is out of reach
# end
# Thinking in JS world in m we have access to outer but in ruby NAH!
# Let's expose inner to outer...