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
(ns frontend.access | |
(:require [reagent.ratom :refer-macros [reaction]] | |
[frontend.app :refer [app]] | |
[common.domain :as domain])) | |
(def admin #{:domain/admin}) | |
(def user #{:domain/user}) | |
(defn role [] | |
(reaction app [:session :user :role])) |
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
fun.uploadImage = function($files, $event, status) { | |
var def = $q.defer(); | |
if (!$files) return def.promise; | |
status.error = null; | |
status.active = true; | |
status.perc = 0; | |
var req; |
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
// Use | |
// ko.bindingHandlers.fooSearch = createAutocomplete({load: ...}); | |
// viewModel.idHere = "123"; | |
// viewModel.objHere = {_id: "123", name: "foo"}; | |
// viewModel.objHere.subscribe(function(val) { ... selected obj! ... }); | |
// | |
// <input type="text" data-bind="value: idHere, fooSearch: objHere"/> | |
function createAutocomplete(override) { | |
return { |
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
angular.module('fooApp') | |
.factory('Util', function() { | |
var utils = {}; | |
// Would be passed by value if $scope.foo was given directly. | |
// As scope is object it is passed by reference. | |
utils.Pending = function(scope, target) { | |
scope[target] = false; | |
this.start = 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
/* jshint camelcase: false */ | |
/* global $ */ | |
// TODO: multiple items | |
angular.module('fooApp') | |
.factory('autocompleteFactory', function() { | |
var factory = function(overwrites) { | |
return { | |
restrict: 'E', | |
replace: true, |
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
(ns seitti.server | |
(:require [org.httpkit.server :refer [run-server]] | |
[clojure.tools.namespace.repl :as ns-tools] | |
[seitti.env :as env] | |
[seitti.handler :as handler])) | |
(def http-app (atom nil)) | |
(defn -main [& args] | |
(reset! http-app (run-server handler/app {:port env/port}))) |
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
(defmethod restructure-param :path-params | |
[_ {:keys [lets letks parameters] :as acc}] | |
"restructures path-params by plumbing letk notation. generates | |
synthetic defs for the models. example: | |
:path-params [id :- long name :- string]" | |
(if-let [path-params (:path-params parameters)] | |
(let [schema (fnk-schema path-params) | |
model-name (gensym "path-params-") | |
_ (eval `(def ~model-name ~schema)) | |
coerced-model (gensym)] |
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
(ns foobar.core | |
(:require [clojure.core.async :as async :refer [chan go timeout >! alts! alts!! <! <!! close!]])) | |
(defn -main [] | |
(let [running (atom true) | |
num-cars 20 | |
ferry-queue (chan) | |
ferry (chan) | |
intersection (chan) | |
msgs (chan) |
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
(ns foobar.daemon | |
(:require [foobar.main :as main]) | |
(:import [org.apache.commons.daemon Daemon DaemonContext]) | |
(:gen-class | |
:implements [org.apache.commons.daemon.Daemon])) | |
(def state (atom nil)) | |
;; Daemon implementation | |
(defn -init [this ^DaemonContext context]) |
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
(ns working-with-data | |
(:require [metosin.dataset.pizzas :refer [pizzas]])) | |
(conj pizzas {:name "Speciale"}) | |
; v1 | |
(filter (fn [pizza] | |
(if (< (get pizza :price) 8) | |
true)) | |
pizzas) |
OlderNewer