Skip to content

Instantly share code, notes, and snippets.

Ready to take over the world

Matija Marohnić silvenon

Ready to take over the world
Block or report user

Report or block silvenon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am silvenon on github.
  • I am silvenon ( on keybase.
  • I have a public key ASBMkRBQIOMQZD1KKKFsjmxk7FExRR1wmClUd-YvTndoMQo

To claim this, I am signing this object:


Keybase proof

I hereby claim:

  • I am silvenon on github.
  • I am silvenon ( on keybase.
  • I have a public key whose fingerprint is 7462 1CB0 97F9 2CBA 8A0F F41D 344C 1482 0427 45AC

To claim this, I am signing this object:

silvenon /
Last active Apr 11, 2019
An example dropdown using Tether Drop, React Portal and Redux.

Tether Drop + React Portal + Redux

This is an example of using Tether Drop with React Portal (and Redux for managing the state). I was asked if using React Portal is redundant, as both libraries pull the content into the <body>. Using only Drop would cause an invariant violation in React becuase of the DOM mutation, so I'm using React Portal to first bring it outside without React complaining (I don't know how React Portal does it, I haven't checked out the source, but it works). Once it's out of React's supervision, I can apply Drop to it.

  • Dropdown.jsx is the actual dropdown component
  • App.jsx is just an demo that uses it

This is my lazy way out of this limitation using an existing library that has much more features than you need, but chances are that you're going to need a library like React Portal anyway for stuff like modals.


silvenon / mocha-jsdom-test.js
Last active Dec 20, 2017
Mocha setup I use for testing React with jsdom.
View mocha-jsdom-test.js
import jsdom from 'jsdom';
import assert from 'assert';
describe('suite', () => {
let React, utils, Component;
before(() => {
global.document = jsdom.jsdom('<!DOCTYPE html><html><head></head><body></body></html>');
global.window = document.parentWindow;
global.navigator = {userAgent: 'node.js'};
silvenon / chai-as-promised.js
Last active Aug 29, 2015
WebdriverIO example with chai-as-promised.
View chai-as-promised.js
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
var client = require('webdriverio').remote({
desiredCapabilities: {
browserName: 'phantomjs'
silvenon /
Last active Aug 29, 2015
Why is using Browserify a good idea again? There's absolutely nothing I can do to reduce the size of bundled JS if it contains things I don't need.

These are two forEach functions; the one I wrote vs. the one I imported from lodash via Browserify.

(I removed the comments to be more fair.)

View skrollr.js
function debounce(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}}
skrollrCheck = debounce(function() {
var winWidth = window.innerWidth;
if(winWidth >= 600) {
// Init Skrollr
forceHeight: false,//disable setting height on body
silvenon / ie-opacity.css
Created Aug 26, 2014
IE opacity hacks.
View ie-opacity.css
/* IE 5-7 */
filter: alpha(opacity=50);
/* IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
/* ಠ_ಠ */
silvenon / generator-webapp-with-compass.diff
Last active Sep 24, 2015
Changes needed in order to implement Compass back to Yeoman's generator-webapp.
View generator-webapp-with-compass.diff
-sass: {
- files: ['<%= %>/styles/{,*/}*.{scss,sass}'],
- tasks: ['sass:server', 'autoprefixer']
+compass: {
+ files: ['<%= %>/styles/{,*/}*.{scss,sass}'],
+ tasks: ['compass:server', 'autoprefixer']
You can’t perform that action at this time.