Skip to content

Instantly share code, notes, and snippets.

View rmacy's full-sized avatar
✌️
Lovin life!

Ryan Macy rmacy

✌️
Lovin life!
View GitHub Profile
@rmacy
rmacy / what-forces-layout.md
Created April 24, 2019 01:16 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@rmacy
rmacy / interacting-with-return-results.js
Created May 5, 2018 19:51
About function chaining in javascript
[1, 2, 3, 4].map(val => val + 1).filter((a, b) => a > b);
@rmacy
rmacy / interacting-with-return-results.js
Last active May 5, 2018 19:55
About function chaining in javascript
let ourValue = [1, 2, 3, 4].map(val => val + 1).sort((a, b) => a > b);
@rmacy
rmacy / jquery-code-example.js
Last active May 3, 2018 18:00
About function chaining in Javascript
$('#someElementId').removeClass('hidden').addClass('display');
@rmacy
rmacy / animal.js
Last active May 3, 2018 21:30
About function chaining in Javascript
class Animal {
constructor() {
this.pace = null;
}
walk() {
this.pace = "walking";
console.log('our animal is', this.pace);
@rmacy
rmacy / README.md
Created July 13, 2016 20:00 — forked from joshdover/README.md
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

STUN implementations

  • stund
  • Content: server daemon and test client for STUN, RFC-3489 only
  • URL does not load, the project seems abandoned
  • The code is also available on SourceForge, last update was on January 2012
  • TCP and TLS modes not supported
  • The server needs two IPs, it’s mandatory and can not be configured
  • C++, no extra libraries required, Windows port available
  • Version = 0.97 (0.96 package available on Debian, 5 years without updates)

Here are some tidbits from my Glass Services teardown (not actually an APK teardown, more like a odex teardown)

In summary: nothing groundbreaking; everything in here is known anyways.

Eye Gestures

In GlassGestureService, the service detecting winks, there's this enum:

Reciprocal Needs in the Employment Relation

We can look at two sides of the management coin: What do the individuals get out of it? And what benefit does the whole system derive from it?

I will disregard any benefits that accrue to managers just by holding the position of managing. Those are just circular logic. Circular logic abounds in discussions of management and hierarchy. For example, consider status reports. It will be said that status reports are necessary so managers know what their employees are working on. It’s

@rmacy
rmacy / squasher.py
Last active December 20, 2015 06:09
import sys
import os
import glob
def get_contents(file):
with open(file, mode='rU') as f:
for line in f:
yield line
def write_contents(file, iterable):