Skip to content

Instantly share code, notes, and snippets.

(ns inferno.storage
(:import
[com.google.cloud.storage BlobId]
[com.google.cloud.storage BlobInfo]
[com.google.cloud.storage StorageOptions]))
(set! *warn-on-reflection* true)
(defn storage [] (.getService (StorageOptions/getDefaultInstance)))
from fixture import TestCase
from google.appengine.ext import ndb
from hypothesis import given
from hypothesis.strategies import (floats, integers, text, booleans,
datetimes, none, fixed_dictionaries,
lists, sampled_from, composite)
from user import User
PROPERTIES = {
from google.appengine.ext import ndb
class User(ndb.Model):
identity = ndb.ComputedProperty(lambda self: self.key.id())
name = ndb.ComputedProperty(compute_name)
first_name = ndb.StringProperty()
last_name = ndb.StringProperty()
email = ndb.StringProperty()
organization = ndb.ComputedProperty(lambda self: self.key.parent())
(ns csv-example
(:require
[clojure.string :as string]))
(def csv
[["name" "age" "occupation" "gender"]
["Peter Pan" 312 "Lost Boy" "male"]
["Wendy Darling" 14 "Older Sister" "female"]
["Captain Hook" 330 "Pirate" "male"]
["Tinker Bell" nil "Fairy" "female"]])
from app import app
from flask import jsonify, Flask
from google.appengine.ext import ndb
from google.appengine.ext.ndb import metadata
from google.appengine.datastore.datastore_query import Cursor
app = Flask(__name__)
def paginate(kind, urlsafe_cursor=None):
@samedhi
samedhi / gist:1dd328c159f934c10443d916479936a9
Last active December 6, 2016 23:20
Create a new stream
import json
import requests
import subprocess
import sys
BEARER_CMD = 'vault read -field=bearer_token secret/oauth'
BEARER_TOKEN = subprocess.check_output(BEARER_CMD.split(' '))
URL = 'https://oauth-dot-talkiq-integration.appspot.com/stream'
@samedhi
samedhi / build.boot
Created November 14, 2016 17:29
Example of short circuiting on test failures.
(deftask build
"Builds cljs and code for production"
[]
(comp
(cljs :optimizations :advanced)
(target)))
(deftask testing []
(merge-env! :source-paths #{"test"})
identity)
(ns vidiot.listener.paths
(:require
[cljs.spec :as s]
[cljs.spec.impl.gen :as gen]
[cljs.spec.test :as stest]))
(def path (s/coll-of (s/with-gen string? #(s/gen #{"a" "b" "c" "d"}))
:min-count 1
:kind vector?
@samedhi
samedhi / profile.boot
Created August 10, 2015 01:02
My current profile.boot
(require 'boot.repl)
(swap! boot.repl/*default-dependencies*
concat '[[cider/cider-nrepl "0.10.0-SNAPSHOT"]
[refactor-nrepl "1.1.0"]])
(swap! boot.repl/*default-middleware*
conj 'cider.nrepl/cider-middleware)
(set-env!
:source-paths #{"src/clj" "src/cljs" "test/clj"}
:resource-paths #{"html"}
:dependencies '[[adzerk/boot-cljs "0.0-3308-0"]
[adzerk/boot-cljs-repl "0.1.10-SNAPSHOT"]
[adzerk/boot-reload "0.3.1"]
[adzerk/boot-test "1.0.4"]
[cljsjs/hammer "2.0.4-4"]
[cljsjs/media-stream-recorder "1.2.6-0"]
[compojure "1.1.6"]