Skip to content

Instantly share code, notes, and snippets.

View madfriend's full-sized avatar

Alex Chuchunkov madfriend

  • Yandex, OpenCorpora
  • St. Petersburg, Russia
View GitHub Profile
@jauco
jauco / gist:201307
Created October 4, 2009 11:05
Design by contract in javascript
//Design by contract function
function $contracted(pre, post, func){
return function(){
var paramsAsArray,
funcName,
retVal;
paramsAsArray = Array.slice(arguments)
funcName = func.toString().substr('function '.length);
funcName = funcName.substr(0, funcName.indexOf('('));//strip of everything, but the name
@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) -> {
@dherman
dherman / functions.js
Created July 29, 2012 01:44
Function utilities
(function(Fp, Ap) {
var applyMethod = Fp.apply,
bindMethod = Fp.bind,
callMethod = Fp.call;
var sliceMethod = Ap.slice,
concatMethod = Ap.concat;
var apply = callMethod.bind(applyMethod),
bind = callMethod.bind(bindMethod),
@ramainen
ramainen / alc.md
Created January 21, 2012 15:06
Конспект по RBAC и ACL

Конспект по RBAC и ACL

Данный текст - мой набросок после филтрации огромного количества текстов.

По работе стоит задача реализации системы распределения прав. Дабы не строить велосипед, решил посмотреть в CI, Yii, Zend, и так далее. В итоге выяснилось, что даже именитые библиотеки вроде Zend_Acl не решают даже части проблем.

Для того, чтобы не держать в закладках уйму текста, было решено составить этот конспект. Если Вы случайно наткнулись на этот текст, и у Вас есть вопросы, мысли или предложения -