Skip to content

Instantly share code, notes, and snippets.


Khemraj Thapa khyamay

Block or report user

Report or block khyamay

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
OliverJAsh /
Last active Nov 18, 2019
How we gradually migrated to TypeScript at Unsplash

How we gradually migrated to TypeScript at Unsplash

When I joined Unsplash, I frequently watched as bugs inevitably slipped into the codebase due to human error. Having worked extensively with TypeScript in my prior work and side projects, I understood how static types could help.

As well as helping to prevent bugs, static types provide living documentation which helps to better understand and maintain legacy code. TypeScript also harnesses the static types to provide powerful and reliable refactoring tools, such as renaming symbols and object properties.

Our migration to TypeScript had to be gradual, so team members could learn the new syntax on the job, and so we could start to get a feel of the real benefits before fully committing. Thankfully, adding TypeScript does not have to be a large and daunting task—any JavaScript project, small or large, can easily begin a gradual migration to TypeScript.

One Make Day I decided to attempt the

Rich-Harris /
Last active Nov 18, 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.

gaearon / connect.js
Last active Nov 19, 2019
connect.js explained
View connect.js
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
gokulkrishh / media-query.css
Last active Nov 19, 2019
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
##Device = Desktops
##Screen = 1281px to higher resolution desktops
@media (min-width: 1281px) {
fvcproductions /
Last active Nov 19, 2019
A sample README for all your GitHub projects.


INSERT GRAPHIC HERE (include hyperlink in image)

Repository Title Goes Here

Subtitle or Short Description Goes Here

PurpleBooth /
Last active Nov 19, 2019
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


nolanlawson / protips.js
Last active Nov 17, 2019
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// Promise.all is good for executing many promises at once
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
View browserify_for_webpack_users.markdown

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

sebmarkbage /
Last active Nov 14, 2019
React (Virtual) DOM Terminology
You can’t perform that action at this time.