Skip to content

Instantly share code, notes, and snippets.

Avatar

Jon Kuperman jkup

View GitHub Profile
@jkup
jkup / Notes.md
Last active Feb 5, 2018
Docker Question
View Notes.md

My Setup:

  1. I have a Node app running locally with Express + React + etc.
  2. I have an /etc/hosts entry mapping 127.0.0.1 to a necessary hostname 127.0.0.1 really.important.mycompany.com
  3. I have a standalone Docker image running selenium with standalone Chrome (https://hub.docker.com/r/selenium/standalone-chrome/)
  4. I have a webdriverio (http://webdriver.io/) suite of tests that need to run against the really.important.mycompany.com local hostname.

My process:

  1. I start the Docker image with: docker run --name mycompany-selenium --add-host -d --rm -p 4444:4444 selenium/standalone-chrome
View generator.js
function* createName() {
console.log(yield)
}
const name = createName()
name.next('Jon')
View ajax.js
request.onload = function () {
if (this.status >= 200 && this.status < 400) {
var data = JSON.parse(this.response)
data.photos.photo.map(function (photo) {
var image = generateImageFromPhotoObject(photo)
wrapper.appendChild(image)
})
} else {
wrapper.innerHTML = 'We recieved an error from the Flickr API. Please try again later.'
@jkup
jkup / semicolons.scala
Created Oct 13, 2016
Scala No Semicolons
View semicolons.scala
object Foo {
def bar() {
println("no semicolons here!")
val xs = List(1, 2, 3, 4)
xs foreach println
def sumOfSquares(x: Int, y: Int) {
(x * x) + (y * y)
View return.scala
def foo() {
var bar = 42
}
@jkup
jkup / return.js
Created Oct 13, 2016
JavaScript Return
View return.js
function foo() {
var bar = 42;
return bar;
}
View function.scala
def foo() {
println('bar')
}
@jkup
jkup / function.js
Created Oct 13, 2016
JavaScript Function
View function.js
function foo() {
console.log('bar');
}
View copyWithinEx2.js
[1, 2, 3, 4, 5, 6, 7, 8].copyWithin(0, 3);
// copies the values from index 3 to the end of the array ( 4, 5, 6, 7, 8 )
// plays them in place on the array starting at 0 ( value 1 )
// returns [4, 5, 6, 7, 8, 6, 7, 8]
View copyWithinEx1.js
[1, 2, 3, 4, 5, 6, 7, 8].copyWithin(0, 3, 5);
// copies the values from index 3 to 5 ( 4, 5 )
// plays them in place on the array starting at 0 ( value 1 )
// returns [4, 5, 3, 4, 5, 6, 7, 8]
You can’t perform that action at this time.