Skip to content

Instantly share code, notes, and snippets.


Ajinkya Borade steelx

Block or report user

Report or block steelx

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
mauricedb / Subject under test
Last active Jul 15, 2019
Testing stateful React hooks
View Subject under test
import { useState } from 'react';
export function useCounter(initial = 0) {
const [count, setCount] = useState(initial);
return [count, () => setCount(count + 1)];
rishikeshdhokare / git_refresh
Last active Jun 5, 2018
git pull all the repositories in a directory
View git_refresh
for d in ./*/;
do (
cd "$d" &&
echo "updating `basename "$currentDir"`..."
git pull
fokusferit /
Last active Jul 23, 2019
Difference between Shallow, Mount and render of Enzyme


Real unit test (isolation, no children render)

Simple shallow


  • constructor
  • render
ebraminio / upload.go
Last active Jun 25, 2019
golang upload client and server
View upload.go
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename'
package main
import (
kennetpostigo /
Last active Dec 13, 2018
How I migrated from ReactRouter v2 to v4

First couple things I thought about when migrating after reading the docs

So migrating my existing app wasn't as troublesome as I originally thought. First thing I did was take a look at my router and routes and figure try to make a mental model of all the files where I had nested routes in the existing app because those components/containers will contain {this.props.children}. So I need to replace those with the nested <Match /> components.

So just to give an example:

In v2:

<Router history={history}>
  <Route path="/" component={App}>
busypeoples /
Last active May 13, 2019
Mocha/Chai/Enyzme test setup with create-react-app

Basic setup for using Enzyme/Mocha/Chai with create-react-app

This is a temporary solution. Might change in the near future, this depends on how create-react-app will implement testing.

create-react-app quick-test-example

cd quick-test-example

npm run eject
Rich-Harris /
Last active Jul 19, 2019
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

EtienneR / Gulpfile.js
Created Mar 17, 2016
Auto reload your Go webserver with Gulp
View Gulpfile.js
const gulp = require('gulp'),
util = require('gulp-util'),
notifier = require('node-notifier'),
sync = require('gulp-sync')(gulp).sync,
reload = require('gulp-livereload'),
child = require('child_process'),
os = require('os');
var server = null;
Yimiprod / difference.js
Last active Jul 23, 2019
Deep diff between two object, using lodash
View difference.js
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
View hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/Book</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
You can’t perform that action at this time.