Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
chris-ramon / README.md
Created March 19, 2019 02:43 — forked from joyrexus/README.md
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@chris-ramon
chris-ramon / .vimrc
Created March 15, 2019 05:25 — forked from simonista/.vimrc
A basic .vimrc file that will serve as a good template on which to build.
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@chris-ramon
chris-ramon / CountLinesAndLetters.js
Created March 7, 2019 01:08 — forked from maxrabin/CountLinesAndLetters.js
Example Lambda Function to process lines of text files when uploaded to S3
'use strict';
var AWS = require('aws-sdk');
var S3 = new AWS.S3();
var readline = require('readline');
exports.handler = function (event, context) {
//Get S3 file bucket and name
//Make sure to loop through event.Records, don't assume there is only 1 in production!!!
var bucket = event.Records[0].s3.bucket.name;
var key = event.Records[0].s3.object.key;
@chris-ramon
chris-ramon / lambda-s3-read-write-by-line.js
Created March 7, 2019 01:08 — forked from hboylan/lambda-s3-read-write-by-line.js
AWS Lambda function to read and write S3 files by line to perform efficient processing
const stream = require('stream')
const readline = require('readline')
const AWS = require('aws-sdk')
const S3 = new AWS.S3()
// read S3 file by line
function createReadline(Bucket, Key) {
// s3 read stream
const input = S3
@chris-ramon
chris-ramon / jessfraz.md
Created August 5, 2018 04:02 — forked from acolyer/jessfraz.md
Containers, operating systems and other fun things from The Morning Paper
@chris-ramon
chris-ramon / upload_file.js
Created August 26, 2014 14:37
upload files angularjs
angular.module('demoApp').controller('someCtrl', function($scope, $http) {
$scope.setFile = function(elem) {
$scope.inputField = elem;
$scope.file = elem.files[0];
};
$scope.uploadFile = function () {
var fd = new FormData();
fd.append("displayPic", $scope.file);
$http.post('/upload-file', fd, {
headers: {'Content-Type': undefined},
@chris-ramon
chris-ramon / npm
Last active July 6, 2017 17:22
npm notes
# list global modules
npm list -g --depth=0
# check node package version
npm info webpack version
# install specific module version
npm install graphql@0.4.3
# rebuild package
@chris-ramon
chris-ramon / protractor.js
Last active September 10, 2016 05:54
protractor examples
// using the gulp-angular yo generator
// run debug mode
reset && nvm use 0.10.0 && ./node_modules/protractor/bin/protractor protractor.conf.js
// place the following within the code where you want to pause
browser.pause();
// make sure use protractor 1.6>
"protractor": "~1.7.0",
// java -Dwebdriver.chrome.driver=/Users/chris/projects/xims-platform/xims-app/node_modules/protractor/selenium/chromedriver -jar /Users/chris/projects/xims-platform/xims-app/node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar
//
@chris-ramon
chris-ramon / aes256-gcm.go
Created July 25, 2016 17:38 — forked from kkirsche/aes256-gcm.go
AES-256 GCM Encryption Example in Golang
package example_test
import (
"crypto/aes"
"crypto/cipher"
"hex"
"io"
)
// AES-GCM should be used because the operation is an authenticated encryption
@chris-ramon
chris-ramon / main.go
Created July 25, 2016 17:38 — forked from manishtpatel/main.go
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)