This file contains hidden or 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
(def react-sortable-hoc (aget js/window "deps" "react-sortable-hoc")) | |
(defn make-sortable-element-component [wrapped-component] | |
(let [sortable-element-factory (.-SortableElement react-sortable-hoc)] | |
(-> wrapped-component | |
r/reactify-component | |
sortable-element-factory | |
r/adapt-react-class))) | |
(defn make-sortable-container-component [wrapped-component] |
This file contains hidden or 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
; util | |
(defn tag-dispatch [dispatch tag] | |
(fn [msg] | |
(let [tagged (if (vector? tag) | |
(conj tag msg) | |
[tag msg])] | |
(dispatch tagged)))) | |
; counter |
This file contains hidden or 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
open System | |
open System.IO | |
let gravity = 9.81 | |
let angleOfReach speed distance = 0.5 * Math.Asin((gravity * distance) / Math.Pow(speed, 2.0)) | |
let distanceTravelled speed angle = Math.Pow(speed, 2.0) * Math.Sin(2.0 * angle) / gravity | |
let angle x y = Math.Atan(y / x) |
This file contains hidden or 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
open System | |
let ratio = (1.0 + Math.Sqrt(5.0)) / 2.0 | |
let inputInt (prompt: String) = | |
Console.WriteLine(prompt) | |
int (Console.ReadLine()) | |
let inputFloat (prompt: String) = | |
Console.WriteLine(prompt) |
This file contains hidden or 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
open System | |
let rec queryForNonNegativeInt msg = | |
printf msg | |
let parsed, number = Int32.TryParse(Console.ReadLine()); | |
if parsed then | |
if number < 0 then queryForNonNegativeInt msg | |
else number | |
else queryForNonNegativeInt msg |
This file contains hidden or 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 qartoy.handler | |
(:require [clojure.tools.logging :as log] | |
[ring.util.response :refer [redirect]] | |
[compojure.core :refer :all] | |
[compojure.handler :as handler] | |
[compojure.route :as route] | |
[qarth.oauth :as oauth] | |
[qarth.impl.facebook :refer :all] | |
[qarth.impl.google :refer :all] | |
[qarth.impl.github :refer :all] |
This file contains hidden or 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 'clojure.core.async) | |
;this is the function you want to use | |
(defn lazy-channels [chs] | |
(lazy-seq (cons (let [ [v _] (alts!! chs)] v) (lazy-channels chs)))) | |
;now for the tesging | |
(def chs [ (chan) (chan) (chan) ]) ; the channels can come from anywhere, here we are using three channels for testing |
This file contains hidden or 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
var queue = new TransactionalConcurrentQueue<int>(); | |
using (var scope = new TransactionScope()) | |
{ | |
queue.Enqueue(1); | |
// won't happen | |
queue.Dequeue(x => Console.WriteLine(x)); | |
scope.Complete(); |
This file contains hidden or 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
IQueryable<<>f__AnonymousType0<string>> <>f_AnonymousType0s = Expression[] expressionArray = new Expression[1].Select<string,<>f__AnonymousType0<string>>(Expression.Lambda<Func<string, <>f__AnonymousType0<string>>>(Expression.New(expressionArray[0] = parameterExpression, expressionArray, new MethodInfo[] { (MethodInfo)MethodBase.GetMethodFromHandle(Name, <>f__AnonymousType0<string>) }), new ParameterExpression[] { parameterExpression })); | |
NewerOlder