Skip to content

Instantly share code, notes, and snippets.

@swannodette
swannodette / inference.md
Last active August 7, 2023 16:13
Externs Inference

Externs Inference

Integrating third party JavaScript libraries not written with Google Closure Compiler in mind continues to both be a source of error for users when going to production, and significant vigilance and effort for the the broader community (CLJSJS libraries must provide up-to-date and accurate externs).

In truth writing externs is far simpler than most users imagine. You only need externs for the parts of the library you actually intend to use from ClojureScript. However this isn't so easy to determine from Closure's own documentation. Still in the process of writing your code it's easy to miss a case. In production you will see the much dreaded error that some mangled name does not exist. Fortunately it's possible to enable some compiler flags :pretty-print true :pseudo-names true to generate an advanced build with human readable names. However debugging missing externs means compiling your production build for each missed case. So much time wasted for such simple mistakes damages our sen

@dtolb
dtolb / jssip.md
Last active December 15, 2023 10:46
JsSip Demo

JSSIP with Catapult API

⚠️ This has been updated at JsFiddle*

Prerequisites

  • Register for a Catapult (Bandwidth Application Platform) account here
  • Register a SIP domain
  • Create an endpoint/user
  • If you want to make calls to the PSTN (normal phones) you will need a server to handler events from Catapult
anonymous
anonymous / server.js
Created March 27, 2016 12:35
/* eslint-disable no-console, no-use-before-define */
import Koa from 'koa'
import React from 'react'
import { trigger } from 'redial';
import { renderToString } from 'react-dom/server'
import { Provider } from 'react-redux'
import { match, createMemoryHistory, RouterContext } from 'react-router'
import configureStore from '../store/configureStore'
@akre54
akre54 / backbone.fetch.js
Last active November 22, 2023 19:10
Backbone.ajax with window.fetch
var defaults = function(obj, source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
}
return obj;
}
var stringifyGETParams = function(url, data) {
var query = '';
for (var key in data) {
@nodesocket
nodesocket / bootstrap.flatten.css
Last active April 1, 2021 23:37
Below are simple styles to "flatten" bootstrap. I didn't go through every control and widget that bootstrap offers, only what was required for https://commando.io, so your milage may vary.
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 5, 2024 06:45
A badass list of frontend development resources I collected over time.
@DazWorrall
DazWorrall / Output
Created February 9, 2012 13:06
Testing file upload handling in Flask
in upload handler
in file close
..
----------------------------------------------------------------------
Ran 2 tests in 0.021s
OK
@ctataryn
ctataryn / gist:1401486
Created November 28, 2011 18:46
Clojure Create Tables
(ns my.ns
(:use [korma.db])
(:use [korma.core])
(:require [clojure.java.jdbc :as sql]))
(def dbspec {:classname "org.h2.Driver"
:subprotocol "h2"
:subname "~/db/myapp"
:user "sa"
:password ""})
@rduplain
rduplain / app.py
Created November 10, 2011 15:44
Customize Flask to select a template based on some criteria.
"Customize Flask to select a template based on some criteria."
import os
from flask import Flask, request, render_template
from flask.helpers import locked_cached_property
from jinja2 import FileSystemLoader, TemplateNotFound
# Import a detection utility from your project, not defined here.
# Takes a request object and returns True if browser is mobile.
@paulsmith
paulsmith / verbatim_templatetag.py
Created October 25, 2011 19:03 — forked from ericflo/verbatim_templatetag.py
verbatim Django template tag
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best