Skip to content

Instantly share code, notes, and snippets.

View Manbearpixel's full-sized avatar

Pixxl Manbearpixel

  • Chicago
View GitHub Profile
@Tam
Tam / Swipe-Example.js
Created June 2, 2016 09:38
Vanilla JavaScript Swipe Detection
new Swipe(document.getElementById("gallery"), function(event, direction) {
event.preventDefault();
switch (direction) {
case "up":
// Handle Swipe Up
break;
case "down":
// Handle Swipe Down
break;
@yoavniran
yoavniran / simple-nodejs-iv-encrypt-decrypt.js
Last active January 20, 2022 08:16
nodejs crypto - simple encrypt & decrypt using IV (Initialization Vector)
"use strict";
var crypto = require("crypto");
var EncryptionHelper = (function () {
function getKeyAndIV(key, callback) {
crypto.pseudoRandomBytes(16, function (err, ivBuffer) {
var keyBuffer = (key instanceof Buffer) ? key : new Buffer(key) ;
@chris-rock
chris-rock / crypto-ctr.js
Last active November 10, 2020 02:27
Encrypt and decrypt text in nodejs
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption with CTR
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
function encrypt(text){
var cipher = crypto.createCipher(algorithm,password)
var crypted = cipher.update(text,'utf8','hex')
@erans
erans / encrypt_decrypt_example.js
Last active October 14, 2022 02:31
Example of encryption and decryption in node.js
var crypto = require("crypto")
function encrypt(key, data) {
var cipher = crypto.createCipher('aes-256-cbc', key);
var crypted = cipher.update(data, 'utf-8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
@thomseddon
thomseddon / gist:4703968
Last active October 21, 2020 08:50
Auto Expanding/Grow textarea directive for AngularJS
/**
* The MIT License (MIT)
*
* Copyright (c) 2013 Thom Seddon
* Copyright (c) 2010 Google
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@ofus
ofus / vhost-wildcard-subdomain.conf
Created March 30, 2012 15:19
Apache Virtual Hosts with wildcard subdomain matching
UseCanonicalName Off
<VirtualHost *:80>
ServerAdmin nobody@example.com
ServerAlias *.example.com
VirtualDocumentRoot /var/www/%1/public
DirectoryIndex index.php index.htm index.html
<Directory /var/www/*/public/>
AllowOverride All
</Directory>

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@kitek
kitek / gist:1579117
Created January 8, 2012 17:50
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");