Skip to content

Instantly share code, notes, and snippets.

@JustinBeckwith
JustinBeckwith / app.yaml
Created October 6, 2015 04:41
Using memcached for session state with express and nodejs on AppEngine
runtime: nodejs
api_version: 1
vm: true
env_variables:
PORT: 8080
MEMCACHE_URL: memcache:11211
anonymous
anonymous / upload.cljs
Created April 29, 2015 07:47
(defn upload! [owner]
(let [form (om/get-node owner "upload-form")
io (goog.net.IframeIo.)]
(goog.events.listen
io goog.net.EventType.COMPLETE #(js/console.log "COMPLETE"))
(goog.events.listen
io goog.net.EventType.SUCCESS (fn [_]
(put!
(om/get-state owner :reset-file-drop)
true)
@cdata
cdata / ajax-text.html
Last active August 29, 2015 14:17
Binding example
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../core-ajax/core-ajax.html">
<dom-module id="x-ajax-text">
<!-- We bind the core-ajax `lastResponse` to the `content` property. This
property is not actually published by `x-ajax-text`, but because it is
specified in the template it will be bindable elsewhere in the template -->
<core-ajax id="ajax" url="./content.txt" last-response="{{content}}" auto></core-ajax>
<!-- Here we bind `content` in another place, which will be effectively
equivalent to binding `this.$.ajax.lastResponse`. -->
@malyn
malyn / vim-fireplace-figwheel.diff
Created February 20, 2015 21:12
vim-fireplace patches/hack for compatibility with Figwheel
diff --git a/plugin/fireplace.vim b/plugin/fireplace.vim
index 6c32caa..a415bf8 100644
--- a/plugin/fireplace.vim
+++ b/plugin/fireplace.vim
@@ -232,7 +232,9 @@ function! s:repl.piggieback(arg, ...) abort
else
let arg = ' :repl-env ' . a:arg
endif
- let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
+ "let response = connection.eval('(cemerick.piggieback/cljs-repl'.arg.')')
@bhauman
bhauman / core.cljs
Last active August 16, 2022 12:08
Helpful patterns when developing with ClojureScript Figwheel and Express js
(ns todo-server.core
(:require
[cljs.nodejs :as nodejs]
[figwheel.client :as fw]))
(nodejs/enable-util-print!)
(defonce express (nodejs/require "express"))
(defonce serve-static (nodejs/require "serve-static"))
(defonce http (nodejs/require "http"))
@danesparza
danesparza / negroni-gorilla.go
Last active December 16, 2020 12:36
Negroni with Gorilla mux subrouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"log"
"net/http"
)
@beefsack
beefsack / main.go
Created September 8, 2014 14:53
Example showing OldValue and NewValue empty
package main
import (
"log"
r "github.com/dancannon/gorethink"
"github.com/davecgh/go-spew/spew"
)
type Blah struct {
package main
import (
"log"
"strings"
r "github.com/dancannon/gorethink"
)
func CreateDatabaseIfNotExists(sess *r.Session, dName string) error {
@pagreczner
pagreczner / negroniGorillaMux.go
Last active August 9, 2016 08:50
Negroni and Gorilla Mux with Middleware example - golang
package main
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
)
func main() {
router := mux.NewRouter()
apiV1 := router.PathPrefix("/api/v1").Subrouter()
@igrigorik
igrigorik / json-bq-schema-generator.rb
Last active November 3, 2022 17:34
BigQuery JSON schema generator
require 'open-uri'
require 'zlib'
require 'yajl'
# References
# - https://developers.google.com/bigquery/preparing-data-for-bigquery#dataformats
# - https://developers.google.com/bigquery/docs/data#nested
#
def type(t)