Skip to content

Instantly share code, notes, and snippets.

/****** Object: Table [dbo].[AttributeFilters] Script Date: 3/18/2022 11:17:20 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[AttributeFilters](
[Id] [int] IDENTITY(1,1) NOT NULL,
[AttributeKey] [varchar](20) NOT NULL,
[ValueToFilter] [varchar](100) NOT NULL,
[RoleId] [varchar](10) NOT NULL,
@meghuizen
meghuizen / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@meghuizen
meghuizen / bash-rc.sh
Last active February 18, 2020 19:25
Bash-RC Terminal Colors
# Put this rule behind PS1 in the following files:
# /root/.bashrc
# /etc/skel/.bashrc
# /etc/bash.bashrc
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u\[\033[00m\]@\[\033[01;32m\]\H\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
@meghuizen
meghuizen / sysctl-gigabit.txt
Created July 26, 2013 09:33
Linux gigabit tuning
##
## Please make sure to change this according to your own needs/configuration
## Some values won't be helpful for some configurations (like routers or firewalls)
## If you have a normal server, these settings should work fine
##
## Tested on Dell PowerEdge/PowerVault servers with gigabit, iSCSI, multipathing with Citrix XenServer clients
## Large performance improvement on the default settings!
##
## Carefull selected values!
##

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.
@meghuizen
meghuizen / openssl-example.php
Created May 24, 2013 07:20
OpenSSL Example
<?php
// Create the keypair
$res=openssl_pkey_new();
// Get private key
openssl_pkey_export($res, $privatekey);
// Get public key
$publickey=openssl_pkey_get_details($res);
<?php
/**
* SplClassLoader implementation that implements the technical interoperability
* standards for PHP 5.3 namespaces and class names.
*
* http://groups.google.com/group/php-standards/web/final-proposal
*
* // Example which loads classes for the Doctrine Common package in the
* // Doctrine\Common namespace.
@meghuizen
meghuizen / escape-attrs.js
Created April 18, 2013 08:44
Escape HTML attributes using JavaScript
/**
* Escapes HTML attributes using JavaScript
*/
function escapeHtmlAttr(attr) {
var cdiv = document.createElement('div');
cdiv.setAttribute('abc', attr);
return cdiv.outerHTML
.substr(10, cdiv.outerHTML.length - 18);
@meghuizen
meghuizen / php-encryption.txt
Last active December 14, 2015 21:29
php encryption stuff
* https://github.com/jmhobbs/K3-Encryption/blob/master/classes/kohana/encryption.php
* http://blog.djekldevelopments.co.uk/?p=334
* https://gist.github.com/meghuizen/5147425
* https://bugs.php.net/bug.php?id=62453&edit=1
* http://php.net/manual/en/function.hash-pbkdf2.php
* http://www.itnewb.com/tutorial/Encrypting-Passwords-with-PHP-for-Storage-Using-the-RSA-PBKDF2-Standard
* http://timoh6.github.io/2013/11/05/Secure-random-numbers-for-PHP-developers.html
* https://github.com/ircmaxell/random_compat
@meghuizen
meghuizen / random-key.php
Last active December 14, 2015 20:58
Generate strong random keys (can be used for encryption)
<?php
/**
* Random key generator example.
*
* See: http://timoh6.github.io/2013/11/05/Secure-random-numbers-for-PHP-developers.html
* https://github.com/ircmaxell/random_compat
*
* Code a simplified and modified version of the RandomLib of https://github.com/ircmaxell/RandomLib
* From the File RandomLib/lib/RandomLib/Generator.php the function generateString