Skip to content

Instantly share code, notes, and snippets.

🌎
💀🌷

Lucas AgtLucas

🌎
💀🌷
Block or report user

Report or block AgtLucas

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
View FetchBasicExample.re
let str = ReasonReact.string;
let url = "http://localhost:3000/users";
type user = {
id: int,
name: string,
};
type state =
@AgtLucas
AgtLucas / facebook-contact-info-summary.rb
Created Mar 22, 2018 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
View facebook-contact-info-summary.rb
#! /usr/bin/env ruby
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It dumps all cell phone call + SMS message + MMS records, plus a summary of each.
#
# Place this script inside the extracted Facebook data download folder
# alongside the 'html' folder.
#
@AgtLucas
AgtLucas / login.js
Created Mar 15, 2018 — forked from kentcdodds/login.js
Example of a test that doesn't use enzyme or TestUtils
View login.js
import React from 'react'
function Login({onSubmit}) {
return (
<div>
<form
data-test="login-form"
onSubmit={e => {
e.preventDefault()
const {username, password} = e.target.elements
@AgtLucas
AgtLucas / pwnd.js
Created Mar 2, 2018 — forked from jgrahamc/pwnd.js
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
View pwnd.js
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)
@AgtLucas
AgtLucas / patternMatch.hs
Created Feb 17, 2018 — forked from animatedlew/patternMatch.hs
Here are some examples of pattern matching in Haskell.
View patternMatch.hs
-- Haskell will match starting at the top, until it hits a catchall
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial(n - 1)
-- Haskell is able to match empty lists and x:xs patterns
head' :: [a] -> a
head' [] = error "No head available on empty lists!"
head' (x:_) = x
@AgtLucas
AgtLucas / thinkingInReact.re
Created Feb 10, 2018 — forked from broerjuang/thinkingInReact.re
This is the implementation of thinking in react using reason
View thinkingInReact.re
type product = {
category: string,
price: string,
stocked: bool,
name: string
};
type products = list(product);
let products = [
@AgtLucas
AgtLucas / bsconfig.json
Created Jan 23, 2018 — forked from FiberJW/bsconfig.json
Example ReasonReact BuckleScript Configuration
View bsconfig.json
{
"name": "<Your App Name Here />",
"reason": {
"react-jsx": 2
},
"bsc-flags": ["-bs-super-errors"],
"bs-dependencies": ["reason-react"],
"sources": [
{
"dir": "./src",
View meltdown_in_a_nutshell.md

Basic Algorithm

  1. A secret byte you want to read is stored at inaccessible memory location priv_mem.
  2. The sender triggers an access exception by attempting to access priv_mem.
  3. Due to out-of-order execution, the load of secret and its access in step 4 may happen before the exception fires.
  4. Calculate an offset into a known array probe by multiplying secret by the width of a cache line.
  5. This forces the cache to load probe[offset], caching exactly one chunk of our array.
  6. The exception fires, clearing the modified registers, but cached data is not excised.
  7. Iterate over all 256 offsets into probe to find out which one loads fast. You've determined the value of secret.
@AgtLucas
AgtLucas / array-reduce.js
Created Nov 15, 2017 — forked from edysegura/array-reduce.js
[JS] Using reduce to calculate average
View array-reduce.js
var scores = [1, 4, 6, 8];
var result = scores.reduce((total, score) => total + score) / scores.length;
console.log(result); // 4.75
@AgtLucas
AgtLucas / flow-redux.guideline.md
Created Nov 11, 2017 — forked from sibelius/flow-redux.guideline.md
How to easily type Redux Props with Flow
View flow-redux.guideline.md

How to easily type Redux Props with Flow

Add ExtractReturn helper

// https://hackernoon.com/redux-flow-type-getting-the-maximum-benefit-from-the-fewest-key-strokes-5c006c54ec87
// https://github.com/facebook/flow/issues/4002
// eslint-disable-next-line no-unused-vars
type _ExtractReturn<B, F: (...args: any[]) => B> = B;
export type ExtractReturn<F> = _ExtractReturn<*, F>;
You can’t perform that action at this time.