Skip to content

Instantly share code, notes, and snippets.

View zeusdeux's full-sized avatar
👾
i wear my sunglasses at night so i can — so i can justify the money spent on 'em

Mudit zeusdeux

👾
i wear my sunglasses at night so i can — so i can justify the money spent on 'em
View GitHub Profile
@cqfd
cqfd / Trie.hs
Last active August 29, 2015 14:17
Trie example
module Trie where
import Prelude hiding (lookup)
import Data.Maybe
import qualified Data.Map as M
data Trie = Trie (M.Map Char Trie) Bool
empty :: Trie
empty = Trie M.empty False
@danmactough
danmactough / comment.md
Created December 31, 2013 00:22
Isaac's description of process.nextTick vs. setImmediate

I agree the point you’re making here, 100%. However, a slight correction about Node’s APIs.

First of all, process.nextTick is actually first in, first out. Proof:

$ node -e 'process.nextTick(console.log.bind(console, 1)); process.nextTick(console.log.bind(console, 2))'
1
2
@rwaldron
rwaldron / tdz-1.js
Last active April 4, 2018 21:20
Temporal Dead Zone
{
// The block has begun, we're in a new block scope. The TDZ for the "a" binding has begun
var f = function() {
// 2. Because f() is evaluated before `a` is actually declared,
// an exception will be thrown indicating to the author that
// `a` is not yet defined.
console.log(a);
};
@swyxio
swyxio / chatscroller.jsx
Last active November 15, 2020 21:55
Handy Scroll window manager component for building a Slack-like Chat experience - when you want your chat window to autoscroll down when new messages appear, BUT not while you're scrolling up. Also useful for feedlike or log display components. from ryan florence workshop chat example (course at https://courses.reacttraining.com/courses/517181/…
function ChatScroller(props) {
const ref = useRef()
const shouldScrollRef = useRef(true)
useEffect(()=> {
if (shouldScrollRef.current) {
const node = ref.current
node.scrollTop = node.scrollheight
}
})
const handleScroll = () => {
@dbainbridge
dbainbridge / app.js
Created April 19, 2012 20:48
How to use socket.io with Express 3
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http');
var app = express();
var server = app.listen(3000);
@arobson
arobson / abstractions.md
Last active October 14, 2021 06:46
Rabbit.MQ + Node.js Notes

Abstraction Suggestions

Summary: use good/established messaging patterns like Enterprise Integration Patterns. Don't make up your own. Don't expose transport implementation details to your application.

Broker

As much as possible, I prefer to hide Rabbit's implementation details from my application. In .Net we have a Broker abstraction that can communicate through a lot of different transports (rabbit just happens to be our preferred one). The broker allows us to expose a very simple API which is basically:

  • publish
  • request
  • start/stop subscription
@kimmobrunfeldt
kimmobrunfeldt / 0-osx-for-web-development.md
Last active July 26, 2022 13:30
Install web development tools to Mavericks (OS X 10.9)

Install web development tools to Mavericks (OS X 10.9)

Strongly opinionated set of guides to quickly setup OS X Mavericks for web development. By default OS X hides stuff that normal people don't need to see. These settings are better defaults for developers.

I don't want: any sounds, annoying confirmation dialogs, hidden extensions, superflous animations, unnecessary things running like Dashboard, Notification center or Dock(Alfred/spotlight works better for me).

These are my opinions. Read this document through and pick up the good parts to your preferences.

System preferences

@areknawo
areknawo / LazyHydrate.vue
Created August 13, 2021 11:18
Vue 3 lazy hydration component
<script lang="ts">
import { defineComponent, onMounted, PropType, ref, watch } from "vue";
type VoidFunction = () => void;
const isBrowser = () => {
return typeof window === "object";
};
export default defineComponent({
props: {
echo-server-epoll
echo-server-poll
talk
talk.dSYM