My efforts to port http://www.youtube.com/watch?v=f6kdp27TYZs to Clojure.
func boring(msg string) {
for i := 0; ; i++ {
fmt.Println(msg, i)
time.Sleep(time.Second)
}| (ns async-test.throttle.core | |
| (:require [cljs.core.async :refer [chan close!o sliding-buffer]] | |
| [clojure.string :as string]) | |
| (:require-macros | |
| [cljs.core.async.macros :as m :refer [go alts!]])) | |
| (def c (chan (sliding-buffer 1))) | |
| (def loc-div (.getElementById js/document "location")) | |
| (.addEventListener js/window "mousemove" |
| (defn debounce | |
| ([c ms] (debounce (chan) c ms)) | |
| ([c' c ms] | |
| (go | |
| (loop [start nil loc (<! c)] | |
| (if (nil? start) | |
| (do | |
| (>! c' loc) | |
| (recur (js/Date.) nil)) | |
| (let [loc (<! c)] |
My efforts to port http://www.youtube.com/watch?v=f6kdp27TYZs to Clojure.
func boring(msg string) {
for i := 0; ; i++ {
fmt.Println(msg, i)
time.Sleep(time.Second)
}| #!/bin/bash | |
| if [ -z "$1" ] || [ -z "$2" ] ; then | |
| echo "Usage: imsg [address] [message]" | |
| else | |
| /usr/bin/osascript -e 'tell application "Messages" | |
| send "'"$2"'" to buddy "'"$1"'" of service "E:[email protected]" | |
| end tell' | |
| echo "Sent" | |
| fi |
| ## | |
| # The MIT License (MIT) | |
| # | |
| # Copyright (c) 2014 Ryan Morrissey | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is |
| angular.module('myServices') | |
| .factory('visibilityBroadcaster', function($rootScope, $document, _) { | |
| var document = $document[0], | |
| features, | |
| detectedFeature; | |
| features = { | |
| standard: { | |
| eventName: 'visibilitychange', |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
| /* ******************************************************************************************* | |
| * THE UPDATED VERSION IS AVAILABLE AT | |
| * https://github.com/LeCoupa/awesome-cheatsheets | |
| * ******************************************************************************************* */ | |
| // 0. Synopsis. | |
| // http://nodejs.org/api/synopsis.html |
| // Restify Server CheatSheet. | |
| // More about the API: http://mcavage.me/node-restify/#server-api | |
| // Install restify with npm install restify | |
| // 1.1. Creating a Server. | |
| // http://mcavage.me/node-restify/#Creating-a-Server | |
| var restify = require('restify'); |
| (function () { | |
| 'use strict'; | |
| angular.module('myApp') | |
| .controller('SomeCtrl', SomeCtrl); | |
| SomeCtrl.$inject = ['$scope', '$http', ' alertService']; | |
| function SomeCtrl($scope, $http, alertService) { | |
| $http.put('http://some.url/user/44', { |