Skip to content

Instantly share code, notes, and snippets.

View sompylasar's full-sized avatar

Ivan Babak sompylasar

View GitHub Profile
@sompylasar
sompylasar / cjs-timestamps-dates-inject-via-rawgit.js
Last active December 29, 2017 02:40
Human-readable timestamps in Chrome JSONView.
// Custom JavaScript for websites: https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija?hl=en
// JSONView: https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en
(function () {
var script = document.createElement('script');
script.async = true;
script.src = 'https://rawgit.com/sompylasar/5440f7f0e3e7bc75c64674f14f58f6df/raw/cjs-timestamps-dates.js';
document.head.appendChild(script);
})();
@sompylasar
sompylasar / git-branch.sh
Last active September 8, 2017 23:27
A script that starts a git branch that is dedicated to a task tracking ticket (makes an empty commit that references the ticket).
#!/usr/bin/env bash
## Starts a git branch that is dedicated to a task tracking ticket.
## Makes an empty commit that references the ticket.
##
## Created: 2016-08-22
## Author: sompylasar <[email protected]> https://github.com/sompylasar
## License: MIT
@sompylasar
sompylasar / Viewport.js
Last active March 18, 2017 11:16
Viewport React component with animated scrolling and overlay handling.
import React, { Component, PropTypes } from 'react';
import verge from 'verge';
import { Motion, spring } from 'react-motion';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import styles from './styles.scss';
@sompylasar
sompylasar / actionMonitor.js
Last active March 30, 2017 09:01
Server-side rendering loop for universal sagas (redux-saga)
export default function createActionMonitor({
debug = false,
}) {
let actionMonitorLog = [];
const actionMonitorSubscriptions = [];
const middleware = () => (next) => (action) => {
if ( debug ) {
console.log('[actionMonitor] push:', action); // eslint-disable-line
'use strict';
// The following line enables extended tracking of unhandled promise rejections.
// @see https://github.com/cujojs/when/blob/master/docs/api.md#whenmonitorconsole
require('when/monitor/console');
var when = require('when');
/**
* Converts an object to a thenable that can be resolved to itself.