Skip to content

Instantly share code, notes, and snippets.

View benatkin's full-sized avatar

Benjamin Atkin benatkin

View GitHub Profile
04abc69200bebaf9e938a4a810fedcc0dcc9f4b2a79411b8293ef8fc0e8bc2df1dfd2bb68817e4daf01d898317e2f734d6e95d4cb6181d7b22b1b398a2c6619481
import React from "react";
import { render } from "react-dom";
const curve = (start, control1, control2, end) => {
return [
"M",
start.join(" "),
"C",
control1.join(" "),
control2.join(" "),
const App = () => {
const points = symmetricalCurvePoints({
controlX: 10,
endpointX: 35,
endpointDistance: 15,
controlDistance: 35
})
return (
<div>
<svg
const symmetricalCurvePoints = ({ controlX, endpointX, endpointDistance, controlDistance}) => (
[
[endpointX, 50 - endpointDistance / 2],
[controlX, 50 - controlDistance / 2],
[controlX, 50 + controlDistance / 2],
[endpointX, 50 + endpointDistance / 2]
]
)
const Guide = ({ start, end }) => {
return [
<circle fill="gray" opacity={0.5} cx={start[0]} cy={start[1]} r={1} />,
<path
stroke="gray"
strokeWidth="1"
strokeOpacity={0.5}
fill="transparent"
d={line(start, end)}
/>,
const curve = (start, control1, control2, end) => {
return [
"M",
start.join(" "),
"C",
control1.join(" "),
control2.join(" "),
end.join(" ")
].join(" ");
}
@benatkin
benatkin / html5-logo.json
Last active January 30, 2018 08:09
XML-as-JSON format inspired by Azure templates, jsx, and WordPress shortcodes
{
"[svg xmlns=http://www.w3.org/2000/svg viewBox='0 0 512 512']": [
{"[title]": "HTML5 Logo"},
"[polygon fill='#E44D26' points='107.644,470.877 74.633,100.62 437.367,100.62 404.321,470.819 255.778,512']",
"[polygon fill='#F16529' points='256,480.523 376.03,447.246 404.27,130.894 256,130.894']",
"[polygon fill='#EBEBEB' points='256,268.217 195.91,268.217 191.76,221.716 256,221.716 256,176.305 255.843,176.305 142.132,176.305 143.219,188.488 154.38,313.627 256,313.627']",
"[polygon fill='#EBEBEB' points='256,386.153 255.801,386.206 205.227,372.55 201.994,336.333 177.419,336.333 156.409,336.333 162.771,407.634 255.791,433.457 256,433.399']",
"[path d='M108.382,0h23.077v22.8h21.11V0h23.078v69.044H152.57v-23.12h-21.11v23.12h-23.077V0z']",
"[path d='M205.994,22.896h-20.316V0h63.72v22.896h-20.325v46.148h-23.078V22.896z']",
"[path d='M259.511,0h24.063l14.802,24.26L313.163,0h24.072v69.044h-22.982V34.822l-15.877,24.549h-0.397l-15.888-24.549v34.222h-22.58V0z']",
@benatkin
benatkin / SassMeister-input.scss
Created August 10, 2017 00:56
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
// sass scoping
body {
$wow: url(doge.jpg);
background-image: $wow;
}
@benatkin
benatkin / fabfile.py
Last active March 16, 2017 18:01
mining dogecoin in the cloud
from fabric.api import env, task, run, sudo, cd, local
from fabric.decorators import with_settings
from fabric.operations import put
env.user = 'ec2-user'
env.hosts = [
'ec2-your-address-1.us-west-2.compute.amazonaws.com',
'ec2-your-address-2.us-west-2.compute.amazonaws.com',
'ec2-your-address-3.us-west-2.compute.amazonaws.com',
'ec2-your-address-4.us-west-2.compute.amazonaws.com',
@benatkin
benatkin / hello.js
Created April 24, 2011 08:16
http/https server with node + express + ufw
// I edited this using the ACE editor bookmarklet
// http://ajaxorg.github.com/ace/build/textarea/editor.html
var express = require('express'),
fs = require('fs');
var app = express.createServer({
key: fs.readFileSync('positive.key'),
cert: fs.readFileSync('positive.pem'),
ca: fs.readFileSync('positive-chain.crt')
});