Skip to content

Instantly share code, notes, and snippets.

Lance Pollard lancejpollard

Block or report user

Report or block lancejpollard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lancejpollard
lancejpollard / main.c
Created Mar 22, 2019 — forked from josephg/main.c
kqueue network & file example
View main.c
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/event.h>
#include <netdb.h>
#include <assert.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
@lancejpollard
lancejpollard / encryption.js
Created Dec 14, 2017 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
View encryption.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);
@lancejpollard
lancejpollard / ca.md
Created Dec 1, 2017 — forked from soarez/ca.md
How to setup your own CA with OpenSSL
View ca.md

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

View gist:c8c01fcd242799c262fc

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

View NASMx86: Allocate heap memory
; 1 2 3 4 5 6 7
;01234567890123456789012345678901234567890123456789012345678901234567890
;=======================================================================
;+---------------------------------------------------------------------+
;| |
;| Example using brk() system call for dynamic memory allocations. |
;| |
;| DON'T CONFUSE that brk() used in C Function is different with brk() |
;| systemcall (systemcall 45 for x86 ASM). |
;| |
@lancejpollard
lancejpollard / c-to-assembly.md
Last active Mar 12, 2019
Simple C examples and their Assembly output from GCC 4.9.0
View c-to-assembly.md

addition

int foo(int a, int b) {
  return a + b;
}
@lancejpollard
lancejpollard / thoughts.md
Last active Jan 29, 2018
code whitespace
View thoughts.md

function whitespace

The following looks much more like a "package" without the extra space:

app.get('/', function(req, res){
  res.send('Hello World');
});

app.get('/', function(req, res) {
View hmm.js
var test =
[
['label0', 100, 200, 300, 400, 500],
['label0', 200, 100, 400, 300, 500],
['label1', 100, 100, 100, 100, 100],
['label1', 100, 100, 100, 100, 100],
['label2', 0, 0, 0, 0, 0],
['label2', 0, 1, 1, 0, 0],
];
@lancejpollard
lancejpollard / Readme.md
Last active Aug 29, 2015
The Client-Side Rendering Problem
View Readme.md

The Client-Side Rendering Problem

The core problem with UI rendering boils down to these two questions:

  1. How do you know when something has changed?
  2. How do you most optimally update the UI with those changes?

What has changed?

There are several implementations that can tell you what has been changed, some of which are:

View index.js
var vs = document.getElementById('vs').textContent;
var fs = document.getElementById('fs').textContent;
var canvas = document.querySelector('canvas');
var ctx = canvas.getContext('experimental-webgl', {
alpha: false,
antialias: true,
premultipliedAlpha: false,
stencil: true
});
You can’t perform that action at this time.