Skip to content

Instantly share code, notes, and snippets.

View TrevorJTClarke's full-sized avatar
🙈

Trevor Clarke TrevorJTClarke

🙈
View GitHub Profile
@JakeHartnell
JakeHartnell / README.md
Last active March 19, 2024 16:46
Include README.md files in rust documentation generation

Include README.md in documentation generation and tests

Recentely, I was trying to make sure our README.md files for DAO DAO were included in the documentation generated by cargo doc or rustdoc. Moreover, I wanted code examples in our README.md files to be tested.

Here's a quick gist...

There is of course the doc attribute, and the rust book contains the following example which you are meant to include in your lib.rs or main.rs:

@lrettig
lrettig / iceage.py
Created January 18, 2019 15:03
Simulation script for ice age block times
# Date, blocknum, difficulty as of 2019-01-18
# Script by vbuterin, slightly modified by lrettig
import random
import datetime
import sys
def calc_bomb(i):
period = i // 100000
if (period > 0):
# Subtract 2, this is the original formula
const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const express = require('express')
const elmStaticHtml = require('elm-static-html-lib').default
const readFile = promisify(fs.readFile)
const app = express();
const pathToClient = path.resolve(__dirname, '../client/src')
@rwdcreative
rwdcreative / simple-ui-routing.js
Last active February 10, 2017 17:17
Simple UI-Router
// Default Path
var defaultPath = 'home'
// Set Default State
history.pushState(null, null, '#/' + defaultPath);
// Custom UI Routing
function uiRouter(){
// Create URL Path Array
@DrBoolean
DrBoolean / falg.js
Created December 15, 2015 18:19
F-algebra es2015
const daggy = require('daggy')
const {compose, curry, map, prop, identity, intersection, union} = require('ramda');
const inspect = (x) => { if(!x) return x; return x.inspect ? x.inspect() : x; }
// F-algebras
// Fix
// ============
// Fx is a simple wrapper that does almost nothing. It's much more useful in typed languages to check that we have a recursive f (Fix f)
@paulirish
paulirish / what-forces-layout.md
Last active April 24, 2024 12:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@TrevorJTClarke
TrevorJTClarke / BrowserDeviceInfo.js
Created September 1, 2015 17:52
A quick list of browsers and devices for use in testing. Chrome is used for all devices that need simulation.
var devices = [
{ name: 'Desktop - Huge', width: 2880, height: 1800, ratio: 2, type: 'desktop' },
{ name: 'Desktop - Extra Large', width: 1920, height: 1080, ratio: 1, type: 'desktop' },
{ name: 'Desktop - Large', width: 1440, height: 900, ratio: 1, type: 'desktop' },
{ name: 'Desktop - HiDPI', width: 1366, height: 768, ratio: 1, type: 'desktop' },
{ name: 'Desktop - MDPI', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with HiDPI screen', width: 1440, height: 900, ratio: 2, type: 'desktop' },
{ name: 'Laptop with MDPI screen', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with touch', width: 1280, height: 950, ratio: 1, type: 'desktop' },
{ name: 'Tablet - Portrait', width: 768, height: 1024, ratio: 1, type: 'tablet' },
@TrevorJTClarke
TrevorJTClarke / ChromeEmulatorDeviceList.js
Created August 18, 2015 17:34
Chrome Emulator Device List and Properties
var emulatorDeviceList = [
{ name: 'Amazon Kindle Fire HDX', width: 2560, height: 1600, ratio: 2 },
{ name: 'Apple iPad', width: 1024, height: 768, ratio: 2 },
{ name: 'Apple iPad Mini', width: 1024, height: 768, ratio: 1 },
{ name: 'Apple iPhone 4', width: 320, height: 480, ratio: 2 },
{ name: 'Apple iPhone 5', width: 320, height: 568, ratio: 2 },
{ name: 'Apple iPhone 6', width: 375, height: 667, ratio: 2 },
{ name: 'Apple iPhone 6 Plus', width: 414, height: 736, ratio: 3 },
{ name: 'BlackBerry PlayBook', width: 1024, height: 600, ratio: 1 },
{ name: 'BlackBerry Z30', width: 360, height: 640, ratio: 2 },
@RobertoSchneiders
RobertoSchneiders / deploy_with_ebcli3_on_circleci.md
Last active December 4, 2023 09:07
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

This is how I configured the deploy of my rails apps to AWS Elastic Beanstalk through CircleCI 1.0.

If you are using the Circle CI 2.0, take a look at this article from ryansimms

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
    The aws user must have the right permissions. This can be hard, maybe, this can help you.
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}