Skip to content

Instantly share code, notes, and snippets.

View joshuakfarrar's full-sized avatar
💻
val me: EitherT[IO, Throwable, Human]

Joshua K. Farrar joshuakfarrar

💻
val me: EitherT[IO, Throwable, Human]
  • Washington, D.C.
View GitHub Profile
Applications 42G total
Library 8.6G total
Users 109G total
System 6.3G total
usr 4.4G total
private 4.8G total
----
Total 175.1G / 181G used / 51G available / 233G total
Applications 50G total
(defn qsort [[pivot & xs]]
(when pivot
(let [smaller #(< % pivot)]
(lazy-cat (qsort (filter smaller xs))
[pivot]
(qsort (remove smaller xs))))))
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<script src="http://fb.me/react-0.13.3.js"></script>
</head>
<body>
<script type="text/javascript">
var App = React.createClass({
render: function() {
(def registrar (ref #{}))
(defrecord Person [first-name last-name])
(def rick (->Person "Rick" "James"))
(def charlie (->Person "Charlie" "Murphy"))
(dosync
(alter registrar conj rick)
(alter registrar conj charlie))
// first, we have an object
> var o = { a: 'b', c: 'd' };
undefined
// then we can find its children
> var v = Object.keys(o).map(function(key) { return o[key]; }); // [ 'b', 'd' ]
undefined
// finally, we can pass values through a promise chain,
// where they might be acted upon asynchronously
// wat. do less of this.
/*var facet = '';
for (var item in req.facetsConfigData) {
if (req.facetsConfigData[item].channel_id == req.query.channel) {
facet = req.facetsConfigData[item].type;
}}*/
// and more of this
var facet = _.filter(req.affiliate.config.facets, function(facet) { if (facet.channel_id == req.query.channel) return true; else return false; })[0];
var flags = {
testTransform: (true && true),
another: (true && false)
}
var transforms = {
testTransform: {
apply: flags.testTransform,
function: function(name) { return `${name}!`; }
},
@joshuakfarrar
joshuakfarrar / .eslintrc
Created February 24, 2016 16:49 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
resp = test.get bing_web_url, bing_params.merge(bing_hl_params)
puts resp.inspect
function getRandomDirection() {
return (Math.random()<.5)?'left':'right';
}
console.log(getRandomDirection());
console.log(getRandomDirection());
console.log(getRandomDirection());