Skip to content

Instantly share code, notes, and snippets.

View jasonblanchard's full-sized avatar

Jason jasonblanchard

View GitHub Profile
@brandonkal
brandonkal / go.ts
Created November 29, 2019 06:26
Go -- simplified async error handling in Typescript
export type PromiseType<T extends Promise<any>> = T extends Promise<infer U>
? U
: never
export type Arguments<T> = T extends (...args: infer U) => infer R ? U : never
export type ReplaceReturn<T, TNewReturn> = (...a: Arguments<T>) => TNewReturn
type Fn = (...args: any[]) => any
export type Go<E extends Error, T extends Fn> = {
@int128
int128 / README.md
Last active January 21, 2024 14:52
Watching build mode on Create React App

Create React App does not provide watching build mode oficially (#1070).

This script provides watching build mode for an external tool such as Chrome Extensions or Firebase app.

How to Use

Create a React app.

Put the script into scripts/watch.js.

@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active June 25, 2024 07:29
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

class AccessibleMatch extends React.Component {
componentDidMount() {
this.node.focus()
}
render() {
const { component:Component, ...rest } = this.props
return <div ref={n => this.node = n} tabIndex="-1"><Component {...rest}/></div>
}
}
@danlopez
danlopez / gist:d473c8332e4e2c491467
Last active August 29, 2015 14:21
Potential Reviewers - GET /api/v2/meets/:meet_id/reviewers
{"users":[
{
"id":"4e663844e049bd3331000011",
"first_name":"User",
"last_name":"Number 7"
},
...
]
}
@danlopez
danlopez / gist:43a20bb519ffc1d0e7c6
Last active August 29, 2015 14:21
GET Reviewable Index
{
"reviewables": [
{
"user": {
"id": "4e4c05b8e049bd2e83000007",
"first_name": "User",
"last_name": "Number 3"
},
"mini_meet_id": "532895bd96ce8969e10001b1",
"submission_id": null,
@samselikoff
samselikoff / future-proof.md
Last active April 21, 2023 17:14
Future-proofing your Ember 1.x code

This post is also on my blog, since Gist doesn't support @ notifications.


Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI
  • In general, replace views + controllers with components
  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController
  • Fetch data in your route, and set it as normal properties on your top-level controller. Export an Ember.Controller, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else