This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { AxiosError, AxiosPromise } from 'axios'; | |
type Result<T> = [AxiosError, null] | [null, T]; | |
type AllResult<T> = [AxiosError, null] | [null, T[]]; | |
/** | |
* Wraps an Axios promise to return a tuple with either the error or the response data. | |
* | |
* @template T - The type of the response data. | |
* @param {AxiosPromise<T>} promise - The Axios promise to wrap. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
import ScriptingBridge | |
@objc public protocol SBObjectProtocol: NSObjectProtocol { | |
func get() -> Any! | |
} | |
@objc public protocol SBApplicationProtocol: SBObjectProtocol { | |
func activate() | |
var delegate: SBApplicationDelegate! { get set } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EditorConfig is awesome: http://EditorConfig.org | |
# top-most EditorConfig file | |
root = true | |
# Unix-style newlines with a newline ending every file | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import angular from 'angular'; | |
import AngularResource from 'angular-resource'; | |
import AppEnvironment from 'app-environment'; | |
import { each, where, findWhere, extend, pick, omit } from 'underscore'; | |
export const RewardShopProductModule = angular.module('app.resources.reward-shop-product', [ | |
AngularResource, | |
AppEnvironment | |
]) | |
.service('RewardShopProduct', ($resource: ng.resource.IResourceService, $timeout: any, SHOP_API_BASE: string) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import angular from 'angular'; | |
import { defaults } from 'underscore'; | |
interface IScope extends ng.IScope { | |
url: string; | |
backgroundImage: string; | |
showSpinner: string; | |
maxRetries: string; | |
delay: string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const links = document.querySelectorAll('link[rel="import"]'); | |
Array.from(links).forEach(link => { | |
const template = link.import.querySelector('template'); | |
const clone = document.importNode(template.content, true); | |
document.querySelector(link.getAttribute('destination')).replaceWith(clone); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
... | |
// Express 4.0 | |
app.use(bodyParser.json({ limit: '10mb' })); | |
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' })); | |
// Express 3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WhateverAPI { | |
constructor(baseUrl, clientID, accessToken) { | |
this._baseUrl = baseUrl; | |
this._clientID = clientID; | |
this._accessToken = accessToken; | |
this._baseUrl += this._baseUrl.slice(-1) !== '/' ? '/' : ''; | |
} | |
resolveUrl(path) { | |
return this._baseUrl + path + `?client_id=${this._clientID}&access_token=${this._accessToken}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'#ff2233'.substr(1).match(/.{2}/g).reverse().join('') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var maxTitleHeight = angular | |
.element('.tracker_title') | |
.map(function() { | |
return angular.element(this).height(); | |
}); | |
maxTitleHeight = Math.max.apply(this, maxTitleHeight); | |
angular | |
.element('.tracker_title') |
NewerOlder