export const getImageWidthByUserContext = (width, MAX_WIDTH = 2880) => { | |
if (typeof(window) === 'undefined') return width; | |
// Pixel ratio | |
let qualityRatio = window.devicePixelRatio ? window.devicePixelRatio : 1; | |
// If bad connection, we downgrade | |
let type = null; | |
if (navigator && navigator.connection && navigator.connection.type) type = navigator.connection.type; | |
if (navigator && navigator.connection && navigator.connection.effectiveType) type = navigator.connection.effectiveType; |
import Inferno from 'inferno' | |
import Component from 'inferno-component' | |
import {connect} from 'cerebral/inferno' | |
import {state} from 'cerebral/tags' | |
import InvalidRoute from './InvalidRoute' | |
export default connect({ | |
media: state`useragent.media`, | |
invalidRoute: state`app.invalidRoute` | |
}, |
We're about to hand the architecture for a surveillance police state over to new leadership. Some of Trump's language around free speech and free press has been troubling, and a campaign advisor has already threatened a reporter. This seems like an excellent time for us to create nontechnical educational information on how technology can be used to protect citizen's civil liberties.
The goal of this guide is to create lesson plans which nontechnical people can then use to run classes for groups of nontechnical people. This guide will not make you safe. It will increase your chances of remaining safe for longer. If you are running Windows 10, or a Lenovo laptop, please skip to 4.0 for a discussion of your options before attempting to secure these machines.
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
var ctx = null, usingWebAudio = true; | |
try { | |
if (typeof AudioContext !== 'undefined') { | |
ctx = new AudioContext(); | |
} else if (typeof webkitAudioContext !== 'undefined') { | |
ctx = new webkitAudioContext(); | |
} else { | |
usingWebAudio = false; | |
} |
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"ecmaFeatures": { | |
"jsx": true, | |
"modules": true, |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGKSpYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS | |
AAGGoKcHCBMXGyImVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T | |
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjAyNzQ1MTAw | |
NjcgMC4yMTE3NjQ3MjMxIDAuMjU4ODIzNDg0MiAxTxAoMC4wMzkzODA3NDc4MiAwLjE2 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Simple demonstrations of putting AVR microcontrollers to sleep in power-down mode, | |
which results in minimum current. Coded with Arduino IDE version 1.0.4 (and with | |
the Arduino-Tiny core for the ATtiny MCUs, http://code.google.com/p/arduino-tiny/) | |
For ATmega328P, ~0.1µA. | |
For ATtinyX5 revisions that implement software BOD disable, ~0.1µA, | |
for ATtinyX5 revisions that don't, ~20µA. |