Skip to content

Instantly share code, notes, and snippets.

Mark Brown markbrown4

Block or report user

Report or block markbrown4

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
@markbrown4
markbrown4 / rsa-key-pairs.rb
Created Oct 25, 2019
RSA Key Pair signing in Ruby
View rsa-key-pairs.rb
data = 'hello'
# generate signature and public key
private_key = OpenSSL::PKey::RSA.new(2048)
signature = private_key.sign(OpenSSL::Digest::SHA256.new, data)
public_key = private_key.public_key
# verify signature with public key
rsa_key = OpenSSL::PKey::RSA.new(public_key.to_pem)
rsa_key.verify(OpenSSL::Digest::SHA256.new, signature, data)
@markbrown4
markbrown4 / read-write.js
Created Jan 8, 2019
Read / write access in Flow
View read-write.js
// @flow
// read / write access
type ReadWriteType = {
+readOnly: number | string,
-writeOnly: string
};
function test(obj: ReadWriteType) {
const read = obj.readOnly;
View awk-scss-mod.md

I'm trying to write a program that replaces a scss function call and doubles the input e.g.

input

.color {
  margin: spacing(1.5);
}

.test {
@markbrown4
markbrown4 / middleware.js
Last active Nov 24, 2017
simple express-like middleware
View middleware.js
class Middleware {
constructor () {
this.stack = []
}
use (fn) {
this.stack.push(fn)
}
go (next, remaining = this.stack.slice()) {
View css-grid.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
body {
font-family: sans-serif;
line-height: 1.15;
}
View dnd.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style media="screen">
@font-face {
font-family: "San Francisco";
font-weight: 200;
src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-thin-webfont.woff");
View webpack.config.js
const webpack = require('webpack')
const path = require('path')
const extractCommons = new webpack.optimize.CommonsChunkPlugin({
name: 'commons',
filename: 'commons.js'
})
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const extractCSS = new ExtractTextPlugin('[name].bundle.css')
@markbrown4
markbrown4 / install.sh
Last active Nov 11, 2016
setup dev machine
View install.sh
Software Updates
App Store -> Xcode
launch xCode
xcode-select --install
defaults write NSGlobalDomain KeyRepeat -int 0
defaults write com.apple.finder AppleShowAllFiles YES
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
View iife-semi.js
var eggs = true
(function() {
console.log(eggs)
})
// => TypeError: true is not a function
View no-semis.js
const Todo = (props, send)=> {
const todo = props.todo
const index = props.index
return html`
<li>
<input
type="checkbox"
${todo.completed ? 'checked' : ''}
onchange=${(e)=> onChange(e, index)}
You can’t perform that action at this time.