Skip to content

Instantly share code, notes, and snippets.

😓
Finding a way to balance work and open source, sorry.

Matija Marohnić silvenon

😓
Finding a way to balance work and open source, sorry.
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
@silvenon
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: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
- tasks: ['sass:server', 'autoprefixer']
-}
+compass: {
+ files: ['<%= config.app %>/styles/{,*/}*.{scss,sass}'],
+ tasks: ['compass:server', 'autoprefixer']
+}
...
@silvenon
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)";
/* ಠ_ಠ */
View skrollr.js
// DEBOUNCE FUNCTION via @http://davidwalsh.name/javascript-debounce-function
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
skrollr.init({
forceHeight: false,//disable setting height on body
mobileDeceleration:0.05,
@silvenon
silvenon / 0.forEach.md
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.
View 0.forEach.md

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.)

@silvenon
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'
}
});
chai.use(chaiAsPromised);
chai.should();
@silvenon
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
silvenon / 0.Readme.md
Last active Apr 11, 2019
An example dropdown using Tether Drop, React Portal and Redux.
View 0.Readme.md

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.

Notes

View keybase.md

Keybase proof

I hereby claim:

  • I am silvenon on github.
  • I am silvenon (https://keybase.io/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:

You can’t perform that action at this time.