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
// Required modules. | |
var cradle = require('cradle'); | |
var util = require('util'); | |
var http = require('http'); | |
// Config. | |
var config = require('./config'); | |
// Create a new HTTP server to accept Postmark POSTs. | |
http.createServer(function(req, res) { |
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
# Add aliases for the bindings to use brackets, e.g. bind-value becomes [value] | |
chip.Binding.bindings.slice().forEach (binding) -> | |
name = binding.name | |
return if name.indexOf('-*') >= 0 | |
if binding.name.indexOf('bind-') is 0 || binding.name.indexOf('attr-') is 0 | |
name = '[' + name.replace(/^(bind|attr)-/, '') + ']' | |
chip.binding name, binding.priority, binding.handler | |
else if binding.name.indexOf('on-') is 0 | |
name = '(' + name.replace(/^on-/, '') + ')' |
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
function Class() {} | |
Class.extend = extend; | |
module.exports = Class; | |
function extend(Subclass, prototype) { | |
// Support no constructor | |
if (typeof Subclass !== 'function') { | |
prototype = Subclass; | |
var SuperClass = this; | |
Subclass = function() { |
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
function Model() { | |
var constructor = function(props) { | |
Object.keys(props).forEach(function(key) { | |
this[key] = props[key]; | |
}, this); | |
}; | |
constructor.prototype = Object.create(Model.prototype); | |
constructor.prototype.constructor = constructor; | |
return constructor; |
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
#!/bin/sh | |
# | |
# Copies the docs over to the website repository and commits it | |
folder_name=${PWD##*/} | |
LAYOUT_PREFIX='---\r\nlayout: default\r\n---\r\n\r\n' | |
mkdir -p "../chip-js.github.io/docs/$folder_name" | |
if [ -d "docs" ]; then |
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
function (user, context, callback) { | |
var request = require('[email protected]'); | |
var async = require('[email protected]'); | |
// Check if email is verified, we shouldn't automatically | |
// merge accounts if this is not the case. | |
if (!user.email_verified) { | |
return callback(null, user, context); | |
} | |
var userApiUrl = auth0.baseUrl + '/users'; |
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
function (user, context, callback) { | |
if (!user.app_metadata) { | |
user.app_metadata = {}; | |
} | |
if (!user.app_metadata.userId || user.app_metadata.userId.length < 24) { | |
var idLength = 24; | |
var chars = ( | |
'0123456789abcdefghijklmnopqrstuvwxyz' | |
).split(''); |
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
export function observe(key, callback, opts) { | |
const single = !Array.isArray(key); | |
const keypaths = single ? [ key ] : key; | |
const parts = keypaths.map(keypath => keypath.replace(/\[(\d+)\]/g, '.$1').split('.')); | |
const keys = parts.map(parts => parts[0]); | |
const fn = callback.bind(this); | |
let last = parts.map(parts => getNestedValue(this.get(), parts)); | |
if (!opts || opts.init !== false) { |
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
{#if match !== null} | |
<slot></slot> | |
{/if} | |
<script> | |
import { getHistory, matchPath, ROUTING_CONTEXT } from './index.js'; | |
import { writable } from 'svelte/store.js'; | |
import { setContext, onDestroy } from 'svelte'; | |
const history = getHistory(); | |
const matchStore = writable(null); |
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
/** | |
* Tiny. Compiled code for signals results in 15 lines of JS, < 500 bytes of uncompressed code. | |
* | |
* Usage: | |
* | |
* const clickedSave = createSignal<Doc>(); | |
* | |
* clickedSave(doc => { | |
* // do something to save the doc, or when the doc is saved | |
* }) |
OlderNewer