Skip to content

Instantly share code, notes, and snippets.

View Gozala's full-sized avatar
😱
Oh well

Irakli Gozalishvili Gozala

😱
Oh well
View GitHub Profile
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@Gozala
Gozala / Functional.md
Created September 14, 2012 21:39
List of good talks / posts outlinig benefits of functional over OOP
@jameswomack
jameswomack / javascript_background_thread.js
Created September 11, 2012 06:41
Extend function prototype to run a function as a WebWorker
Function.prototype.runOnBackgroundThread = function (aCallback) {
var _blob = new Blob(['onmessage = '+this.toString()],{"type":"text/javascript"});
var _worker = new Worker((webkitURL.createObjectURL || URL.createObjectURL)(_blob));
_worker.onmessage = aCallback;
_worker.postMessage();
}
var _test = function () {
postMessage((1+1).toString());
}
@Gozala
Gozala / reducers.js
Created May 11, 2012 01:42
Experimenting with clojure reducers
Array.prototype.reduce = this.ArrayReduce || Array.prototype.reduce
var console = window.console
var global = this
function assert(actual, expected) {
if (arguments.length < 2 && actual)
return actual
if (actual === expected)
return actual
if (JSON.stringify(actual) == JSON.stringify(expected))
return JSON.stringify(actual)
@Calvein
Calvein / Custom.css
Created March 23, 2012 20:24
Solarized Dark Skin for the Chrome DevTools
body#-webkit-web-inspector #main{background-color:#002b36!important}body#-webkit-web-inspector #main .panel.network,body#-webkit-web-inspector #main .panel.timeline,body#-webkit-web-inspector #main .panel.profiles,body#-webkit-web-inspector #main .panel.audits,body#-webkit-web-inspector #main .panel.extension{background-color:#fff!important}body#-webkit-web-inspector #console-messages a:hover,body#-webkit-web-inspector #console-messages .console-formatted-function,body#-webkit-web-inspector #console-messages .console-formatted-object{color:#93a1a1!important}body#-webkit-web-inspector #console-prompt,body#-webkit-web-inspector #console-messages a,body#-webkit-web-inspector #console-messages .console-message,body#-webkit-web-inspector #console-messages .console-group-messages .section .header .title{color:#839496!important}body#-webkit-web-inspector #console-messages .console-formatted-null,body#-webkit-web-inspector #console-messages .console-formatted-undefined{color:#657b83!important}body#-webkit-web-inspect
@swannodette
swannodette / gist:2038633
Created March 14, 2012 18:52
project.clj
(defproject cljs-demo "0.1.0-SNAPSHOT"
:description "ClojureScripting!"
:dev-dependencies [[lein-cljsbuild "0.1.2"]]
:cljsbuild {:builds [{:source-path "src"
:compiler {:optimizations :simple
:pretty-print true}}]})
;; then from project directory
;; ---------------------------
;;
@dherman
dherman / short-functions.js
Created March 10, 2012 16:14
using -> for concise functions and => for TCP functions
// 1. Shorter function syntax.
//
// This version does not respect "Tennent's correspondence principle" -- it's nothing
// more than syntactic sugar for the traditional function syntax. That means when you
// see the normal braced body of a function, whether it's a longhand function or this
// shorthand version, there's no difference: return, this, and arguments are all tied
// to the new function body, and there's no implicit returning of the last expression
// result.
a.some((x) -> {
@jrburke
jrburke / amdconfig.md
Created January 18, 2012 00:52
Rough draft of common config understood by loaders

Attempt to list some possible standard AMD loader configuration values.

An AMD loader is not required to implement all of these configuration values, but if it does provide a capability that is satisfied by these configuration values, it should use these configuration values and structures.

baseUrl

String: Indicates the root used for ID-to-path resolutions. Relative paths are relative to the current working directory. In web browsers, the current working directory is the directory containing the web page running the script.

@Gozala
Gozala / index.html
Created November 17, 2011 17:24
GistView: d3.js ~ Streamgraph
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>d3.js ~ Streamgraph</title>
<!-- absolute url -->
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.5.1"></script>
<script type='text/javascript' src='http://mbostock.github.com/d3/d3.layout.js?2.5.1'></script>
<!-- relative urls -->
<link href='stream.css' rel='stylesheet' type='text/css'/>
@nolanw
nolanw / fscript.rb
Last active September 26, 2015 22:38
Inject F-Script into any app on OS X 10.7 or 10.8. (Yet another F-Script Anywhere replacement.)
#!/usr/bin/env ruby
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework"
if ARGV.empty?
puts "Usage: #{$0} process_name"
exit
end
GDB = IO.popen("gdb", 'w')