Skip to content

Instantly share code, notes, and snippets.

View rla's full-sized avatar

Raivo Laanemets rla

View GitHub Profile
@webholics
webholics / Barrier flow control for NodeJS
Created February 18, 2011 08:49
The barrier can be used to control concurrent flows in NodeJS. It counts how often the function returned is called and executes the callback if it has been called "count" times.
/*
* A barrier that counts how often a function is called.
*/
module.exports = function(count, callback) {
var c = count;
// if count is 0 execute callback
if(c == 0)
callback();
@hyle
hyle / ko.utils.signatures.js
Last active May 14, 2022 21:15
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
@tj
tj / app.js
Created December 17, 2011 23:15
express 3.x cookie session middleware example
var express = require('express')
, cookieSessions = require('./cookie-sessions');
var app = express();
app.use(express.cookieParser('manny is cool'));
app.use(cookieSessions('sid'));
app.get('/', function(req, res){
req.session.count = req.session.count || 0;
@malarkey
malarkey / Contract Killer 3.md
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@Raynos
Raynos / exploration.md
Last active August 18, 2022 22:31
Exploration of a TodoMVC app using FRP javascript techniques.

Implementing TodoFRP in JavaScript

FRP to me means building your app by transforming values over time, from the input to the current state to the display.

This implementation is based on a the [graphics][1] library and is heavily inspired by [Elm][2]

A full implementation of TodoFRP can be found [online at Raynos/graphics example server][3]

Moving away from MVC

@mdub
mdub / syslog-injection.sh
Created May 1, 2013 01:25
Redirect STDOUT and STDERR into syslog, using "logger", and bash process substitution
# Redirect STDOUT/STDERR into syslog
exec > >(logger -p user.info) 2> >(logger -p user.warn)
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active June 13, 2024 10:59
A badass list of frontend development resources I collected over time.
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active April 17, 2024 10:51
Backend Architectures Keywords and References
@codearachnid
codearachnid / woocommerce_update_stock_status.php
Created July 7, 2013 14:11
set the stock status for all products in your WooCommerce store
<?php
/**
* set the stock status for all products in your WooCommerce store
* @return void
*/
function woocommerce_update_stock_status(){
global $wpdb;
// set all status for products with 0 or less stocked quantity
@danharper
danharper / background.js
Last active May 22, 2024 11:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});