Skip to content

Instantly share code, notes, and snippets.

View montlebalm's full-sized avatar
✌️

Chris Montrois montlebalm

✌️
  • Airtable
  • Louisville, CO
View GitHub Profile
@montlebalm
montlebalm / index.tsx
Created April 19, 2023 16:35
t3-solidjs
import { Component, createSignal, For, JSX } from "solid-js";
//
// Types
//
type Mark = "x" | "o";
type Coord = `${number},${number}`;
@montlebalm
montlebalm / keybindings.json
Last active June 28, 2017 22:36
VS Code - Reload Chrome
[
{
"key": "cmd+r cmd+r",
"command": "workbench.action.tasks.runTask",
"args": "Reload Chrome"
}
]
@montlebalm
montlebalm / test.html
Last active March 6, 2016 20:29
Handlebars perf comparison of partials vs templates
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Handlebars: Helper vs Partial</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
<script id="template" type="x-template/handlebars">
<p>Hey there my name is {{name}}</p>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="output_h"></div>
<div id="output_v"></div>
<script src="virtual-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
@montlebalm
montlebalm / Component.js
Last active September 22, 2015 15:23
Testing React Components with React Router
var Component = React.createClass({
contextTypes: {
router: React.PropTypes.func
},
propTypes: {
isCool: React.PropTypes.bool
},
getDefaultProps() {
return {
isCool: false
@montlebalm
montlebalm / .vimrc
Created September 25, 2014 16:28
Get it on. Vim till the break of dawn.
set nocompatible
filetype off
filetype plugin indent off
" -----------------------------------------------------------------------------
" Plugins
" -----------------------------------------------------------------------------
" Set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle.vim/
var F2Class = function() {
return {
emit: function(name, data) {
console.log("Safe and sound");
}
};
};
@montlebalm
montlebalm / F2: sandboxing by appIds
Created January 21, 2014 18:23
This approach allows an app to specify a range of AppIds it is allowed to communicate with. Pros: - Simple or detailed configuration - Makes F2 plugins easy, since each app gets its own instance Cons: - If the app is used in multiple pages, the configuration list might be very long - It requires the app to specify every possible app it wants to …
/*
Summary
In this example, each app gets its own instance of F2. Every instance of F2
will share all the same page events. This setup will allow each app to add its
own plugins without interfering with the rest of the apps.
We'll add internal checks to make sure events are only broadcast to "trusted"
apps. This should allow any app to specify any other app on the page
*/
Goals for sandboxing:
- Prevent "F2.Events.emit = function() { }" hijacking
- Apps can sandbox themselves without the container
- Sandboxing is optional
- Sandboxed apps can emit global events
- Apps can be sandboxed with any app from any domain
@montlebalm
montlebalm / F2: Sandboxing via AMD plugin
Created January 21, 2014 17:45
Playing with sandboxing in F2 by using an AMD plugin. The plugin uses a domain key to group apps.
// Inside F2 library
// --------------------------------------------------------------------------------
// Override "define" to give us the appId inside the plugin
var oldDefine = define;
define = function(id, deps, fn) {
// Append the appId to the dependency
if (deps && deps instanceof Array) {
for (var i = 0; i < deps.length; i++) {
if (deps[i].indexOf('F2Sandbox!') === 0) {