Skip to content

Instantly share code, notes, and snippets.

View evocateur's full-sized avatar

Daniel Stockman evocateur

View GitHub Profile
@tomhicks
tomhicks / useTaskQueue.ts
Created January 11, 2021 11:41
React Hook for queueing and processing async tasks sequentially
function useTaskQueue(params: {
shouldProcess: boolean
}): {
tasks: ReadonlyArray<Task>
isProcessing: boolean
addTask: (task: Task) => void
} {
const [queue, setQueue] = React.useState<{
isProcessing: boolean
tasks: Array<Task>
@danieleggert
danieleggert / GPG and git on macOS.md
Last active October 27, 2024 11:07
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
import React from 'react'
const provideContext = (contextKey, contextType) => (
React.createClass({
childContextTypes: {
[contextKey]: contextType
},
getChildContext() {
const { children, ...props } = this.props
{
"presets": [
"es2015"
],
"plugins": [
"transform-runtime",
"transform-export-extensions"
]
}
@jamiebuilds
jamiebuilds / gulpfile.js
Created October 5, 2015 20:45
Example multi-file gulp setup
export lint from './task-lint';
export test from './task-test';
export build from './task-build';
export dev from './task-dev';
export default dev;
"use strict";
var _ = SM.import('lodash');
var DOM = SM.import('sm-dom');
var Uri = SM.import('sm-uri');
// WebKit (as of version 538.35.8) fires a useless popstate event after every
// page load, even when the page wasn't popped off the HTML5 history stack. We
// only want to handle popstate events that result from a page actually being
// popped off the HTML5 history stack, so we need a way to differentiate between
@toumorokoshi
toumorokoshi / Gruntfile.js
Last active May 8, 2018 09:45
How I use grunt w/ buildout
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
myproject: {
files: [
{ src: ['myproject/static/source/myproject/js/**/*.js'] }
]
@clarle
clarle / README.md
Last active December 20, 2015 13:59
Architecture of "smart" ModelLists

ModelList Re-write

Goals and Current Usage

The goal in re-writing ModelList is to take advantage of the features in LazyModelList which improve performance, which is mainly to not immediately regenerate plain JavaScript objects that are added to the ModelList.

Right now, a ModelList is sometimes used like this inside a View:

template: function(data, options) {
 /* Interpolates data into a string of HTML */
@caridy
caridy / README.md
Last active December 19, 2015 18:48

What is this?

This is a script that you can add to your application to generating yui meta data and compiling yui modules using express-yui and locator. As a result, a build folder will be generated with everything that was compiled.

How does this work?

Locator walks the folder structure for your app, and finds any yui module, including build.json or just traditional *.js files with the corresponding YUI.add() statement. Generating the result of the operation as well as the metadata associated to each module.

Under the hood, it uses shifter to generate almost everything that is needed.

@tivac
tivac / plugin-lazy-images.js
Last active December 17, 2015 13:19
Image lazy-loader
/*jshint browser:true, yui:true */
YUI.add("plugin-lazy-images", function(Y) {
"use strict";
var plugins = Y.namespace("GW2.Plugins"),
LazyImages;
LazyImages = Y.Base.create("lazyImages", Y.Plugin.Base, [], {
// Y.Base lifecycle fns
initializer : function() {