Skip to content

Instantly share code, notes, and snippets.

View n3ps's full-sized avatar

Francis Nepomuceno n3ps

View GitHub Profile
@n3ps
n3ps / enzyme_render_diffs.md
Created May 8, 2020 21:57 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@n3ps
n3ps / commands.txt
Created April 28, 2020 19:54 — forked from theparticleman/commands.txt
Node, .NET Core, Python, Ruby, Rust, Kotlin and Swift build/runtime environments in Docker
docker run -v [local path]:/code -it node bash
cd /code
echo "console.log('Hello, World');" > app.js
node app.js
docker run -v [local path]:/code -it microsoft/dotnet bash
cd /code
dotnet new console
dotnet run
@n3ps
n3ps / css-stats-ack.sh
Created November 28, 2019 14:12 — forked from pjkix/css-stats-ack.sh
shell script to generate some css file statistics
#!/bin/bash
## v1.0.6
## this script will gernerate css stats
### example output
# CSS STATS
# ----------
# Floats: 132
@n3ps
n3ps / google-auth.js
Created April 5, 2019 03:54 — forked from Greyeye/google-auth.js
passport.js sample node server , to allow only user from your company. Company must be hosted by Google. (eg Google Enterprise, Google Apps)
var express = require('express');
var http = require('http');
var path = require('path');
var passport = require('passport');
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
var GOOGLE_CLIENT_ID = "xyz1234.apps.googleusercontent.com";
var GOOGLE_CLIENT_SECRET = "--google client secret";
// Serialized and deserialized methods when got from session
@n3ps
n3ps / iframe_contents.html
Created March 8, 2019 20:42 — forked from bprosnitz/iframe_contents.html
iframe origin security: dispatchEvent vs postMessage
<script>
window.addEventListener('message', function(event) {
console.log('iframe: Got postmessage in origin ' + location.origin + ' from origin: ' + event.origin + '(' + event.data + ')');
});
window.addEventListener('dispatchToIframe', function() {
console.log('iframe: Got dispatchEvent() in origin ' + location.origin + '(from index.html)');
});
setTimeout(function() {
window.dispatchEvent(new CustomEvent('dispatchFromIframe'));
@n3ps
n3ps / destructuring.js
Created September 20, 2017 07:54 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];