Skip to content

Instantly share code, notes, and snippets.

View silvenon's full-sized avatar

Matija Marohnić silvenon

View GitHub Profile
@fredrick
fredrick / App-example-test.js
Last active April 6, 2018 12:39
React Router Test Context Helper
var React = require('react/addons'),
TestUtils = React.addons.TestUtils,
TestContext = require('./TestContext'),
App = require('./App.jsx'),
app = TestContext.getRouterComponent(App);
describe('App', function() {
it('has something', function() {
expect(app.getDOMNode().textContent).toContain('something');
});
@christian-bromann
christian-bromann / Readme.md
Last active August 8, 2017 22:04
Run Chrome headless

Run Chrome headless

The good old PhantomJS times are over. The project is not maintained anymore and it is recommended to switch over to Chrome headless. Just run a local Selenium standalone server:

$ java -jar Sites/selenium-server-standalone-3.4.0.jar
import fs from 'fs';
import path, { resolve } from 'path';
import assert from 'assert';
import Module from 'module';
import jsdom from 'jsdom';
import Mocha from 'mocha';
import chokidar from 'chokidar';
// Let's import and globalize testing tools so
// there's no need to require them in each test
var webdriverio = require('webdriverio');
var webdriverio =
client = webdriverio.remote({
desiredCapabilities: {
name : 'Selenium Test Example',
build : '1.0',
browser_api_name : 'FF35',
os_api_name : 'WinXPSP2-C2',
@tim-evans
tim-evans / document_title.js
Created August 22, 2014 19:28
Document title mixin for Ember.Router
import Ember from "ember";
var get = Ember.get;
var copy = Ember.copy;
var removeObserver = Ember.removeObserver;
var addObserver = Ember.addObserver;
var DocumentTitleMixin = Ember.Mixin.create({
titleTokensDidChange: function () {
@qubyte
qubyte / fetchAntiShim.js
Last active August 29, 2015 14:12
Prevent the github/fetch shim actually shimming, and assign it instead to a variable.
// brfs is needed to use this anti-shim.
var fs = require('fs');
var functionBody = [
'var window = {};',
fs.readFileSync(__dirname + '/path/to/node_modules/fetch/fetch.js', 'utf8'), // Fix the path for your needs.
'return window.fetch;'
].join('\n');
// Assigns a function fetch function to module.exports. Here I elect to use a native Promise implementation (or
// polyfilled). This is trivial to adapt into a library that can take a user defined Promise.
@janko
janko / openssl.md
Last active August 29, 2015 13:58
OpenSSL upgrade instructions

These are upgrading instructions for the new OpenSSL vulnerability, Heartbleed. This is only for Mac, and assumes you have Homebrew installed.

OpenSSL

You need to upgrade OpenSSL to at least version 1.0.1g.

$ brew update
$ brew upgrade openssl
$ brew link --force openssl