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
defmodule Hellostaticplug do | |
use Plug.Router | |
plug Plug.Static, at: "/static", from: :hellostaticplug | |
plug :match | |
plug :dispatch | |
get "/" do | |
Plug.Conn.send_file(conn, 200, "priv/index.html") | |
end |
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
function cd_dir_history() | |
{ | |
OLDPWD="$PWD" | |
echo "# $(date) $USER -> $@" >> "$HISTFILE" | |
command cd "$@" | |
# If this directory is writable then write to directory-based history file | |
# otherwise write history in the usual home-based history file. | |
touch "$PWD/.dir_bash_history" 2>/dev/null \ |
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
(function (root, definition) { | |
var _module_name = "myModule"; | |
if (typeof define === 'function' && define.amd) { | |
define(['jquery', 'lodash'], function($, _){ | |
return (root[_module_name] = definition($, _)); | |
}); | |
} else { | |
root[_module_name] = definition($, _); | |
} |
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
. |
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
; (:require | |
; [goog.dom :as dom] | |
; [goog.events :as events]) | |
(defn log [msg] | |
(js/console.log msg)) | |
(defn listen [el type f] | |
(let [e (dom/getElement el)] | |
(events/listen e type (partial f)))) |
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
//Be safe out there; Check for undefined, null and 'null' and return an empty string | |
_.mixin({ | |
safeString : function(value) { | |
return (typeof value !== 'undefined' && value !== null && value !== "null") ? value : ""; | |
} | |
}); |
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
// Some common IE shims... indexOf, startsWith, trim | |
/* | |
Really? IE8 Doesn't have .indexOf | |
*/ | |
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { | |
"use strict"; | |
if (this === null) { | |
throw new TypeError(); |
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
/** | |
* Underscore mixin to merge objects; last item takes precedence (uses _.extend not _.default) | |
**/ | |
_.mixin({ | |
merge : function() { | |
return _.reduce(arguments, function(list, obj){ | |
return _.extend(list, obj); | |
}, {}); | |
} |
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
var expected = [ | |
[ | |
{item:"aa", hasDup:"false", isDup:"false"} | |
], | |
[ | |
{item:"b1", hasDup:"true", isDup:"false"}, | |
{item:"b2", hasDup:"true", isDup:"true"} | |
], | |
[ | |
{item:"cc", hasDup:"false", isDup:"false"} |
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
(defn super-shake [item value] | |
(start (apply bind item (mapcat (fn [dist] [{:effect :slide, :left dist, :time 375} | |
{:effect :slide, :left (- dist), :time 375}]) | |
(range 500 0 -100))))) |