Skip to content

Instantly share code, notes, and snippets.

@bryanstern
bryanstern / OkHttpStack.java
Last active April 24, 2022 03:17
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@yyx990803
yyx990803 / bind.js
Last active June 15, 2022 09:15
implementing Function.prototype.bind
Function.prototype.bind = function (context) {
if (typeof this !== 'function') {
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var fn = this, // the function to bind
slice = Array.prototype.slice // cache slice method
args = slice.call(arguments, 1), // get the array of addtional arguments (to be curried)
noop = function () {}, // the intermediate function to serve as a prototype chain connector
// (assuming we don't have Object.create() here)
bound = function () {