Skip to content

Instantly share code, notes, and snippets.

@andrejewski
andrejewski / goog.html5history+query.js
Last active March 21, 2019 03:10
goog.HTML5History with query params
/*
A fix for HTML5History with query parameters.
Hey, this wasted my time so here is an explanation.
By default, Closure's goog.HTML5History does the stupid
thing of adding query params of the current location to
whatever new path you are navigating to. I did not need
that so here is the fix:
*/
@andrejewski
andrejewski / text-file.js
Created May 3, 2017 17:08
Landscaper test mods
var fs = require('fs')
var path = require('path')
module.exports = {
getOptions: function () {
return [{
name: 'content',
type: 'input',
default: 'Some text I made',
message: 'Text to write'
@andrejewski
andrejewski / bye-david.js
Last active May 5, 2017 19:04
landscaper codeshift test
module.exports = function transformer(file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.Literal)
.forEach(path => {
var raw = path.node.raw.toLowerCase()
if (raw === '"david"' || raw === "'david'") {
j(path).replaceWith(
j.literal("😿😢👎")

can-dom-events

This is the DOM events API.

The package modules are:

  • can-dom-events which replaces can-util/dom/events
  • can-dom-events/event/make-custom for standardizing custom events
  • can-dom-events/event/make-native for standardizing native events
  • can-dom-events/event/make-compat for compatibility with can-util/dom/events
@andrejewski
andrejewski / refactor-example.js
Created June 27, 2017 03:09
Refactor example of donejs/cli
// OLD
// Returns a .then-able function that installs a single module
// if it is not available in the current path
var installIfMissing = exports.installIfMissing = function(root, module, range) {
var location = module ? path.join(root, module) : root;
if(!module) {
module = root;
}
@andrejewski
andrejewski / travis-firefix.js
Last active July 27, 2017 01:10
Super mod: update Travis Firefox version
var fs = require('fs')
var path = require('path')
module.exports = {
getOptions: function () {
return [{
name: 'version',
type: 'input',
default: '51.0',
message: 'New Firefox version:'
@andrejewski
andrejewski / license-year.js
Last active August 9, 2017 17:00
Super mod: Update license year
var fs = require('fs')
var path = require('path')
module.exports = {
getOptions: function () {
return []
},
run: function (directory) {
var potentialNames = ['LICENSE', 'LICENSE.md', 'license', 'license.md']
@andrejewski
andrejewski / canjs-cleanup-pkg.js
Created August 3, 2017 16:07
Code mod to update CanJs package.json
var unusedDeps = [
'done-serve',
'done-cli',
'bit-docs',
'generator-donejs'
]
var unusedScripts = [
'document',
'develop',
@andrejewski
andrejewski / raj-marko.js
Created September 25, 2017 01:53
Marko bindings for Raj
const {program} = require('raj/runtime')
module.exports = function markoProgram (createApp) {
return class {
onInput (input, out) {
this.makeProgram(input, out)
}
onDestroy () {
this.killProgram()
@andrejewski
andrejewski / raj-live-code.md
Created October 6, 2017 00:31
Agenda for Raj live coding

Recover Password

aka "Forgot password"

Description

We are going to add a new page /authorize#recover-password to the existing /authorize application. This page has an input for entering an email, button for submission, and a link back to the sign in page. It will make a network request to the server with the email and the response we will display to the user.

Goals

Big