Skip to content

Instantly share code, notes, and snippets.

View eliperelman's full-sized avatar

Eli Perelman eliperelman

View GitHub Profile
@eliperelman
eliperelman / jest.config.js
Last active March 11, 2022 11:54
SVG preset for Neutrino
// jest.config.js
const neutrino = require('neutrino');
process.env.NODE_ENV = process.env.NODE_ENV || 'test';
module.exports = neutrino().customJest();
class Foo extends Component {
state = {
email: '',
password: '',
};
handleChange = e => {
this.setState({
[e.target.name]: e.target.value,
});
'use strict';
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
use: [
['@neutrinojs/airbnb', {
"eslint": {
"rules": {
"semi": ["off"],
// Restricting for..of seems pretty controversial, let's disable that.

Keybase proof

I hereby claim:

  • I am eliperelman on github.
  • I am eliperelman (https://keybase.io/eliperelman) on keybase.
  • I have a public key whose fingerprint is 8681 E477 A9A0 335D B3A7 3D95 4546 8CD4 8475 2906

To claim this, I am signing this object:

@eliperelman
eliperelman / nspr.sh
Created October 28, 2014 16:51
Enable/disable NSPR Logging
#!/bin/sh
# Alias this script for easier experience
# Usage:
# ./nspr.sh on
# ./nspr.sh off
NSPR="export NSPR_LOG_MODULES=ObserverService:5"
OPTION=$1
DISK_DEVICE=`adb shell mount | grep '/system' | awk '{ print $1 }'`
eli@precision:~/B2G$ b2gperf --delay=10 --iterations=30 Messages
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: oauth_secret
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: oauth_key
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: build_revision
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: device_name
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: project
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: gecko_revision
2014-08-06 16:21:53,792 B2GPerfRunner WARNING | Missing required DataZilla field: branch
2014-08-06 16:21:53,792 B2GPerfRunner INFO | Reports will not be submitted to DataZilla

Problem

The current process of timing the launching of Firefox OS applications is tricky. At the time of writing, most tests rely on the firing of the window onload event in order to determine when it is ready to use. Unfortunately with the state of dynamic script and view loading, it's impossible to tell when an application is truly ready to be interacted with. The loading of these assets can be deferred, sometimes even to the point where it occurs after window onload. If we want to hold an application accountable to recommended launch times, engineers need only defer more loading until the test measurement completes in order to make metrics look attractive. Couple this with the fact that the event isn't truly indicative of user interactivity and you can see that the current state is unsustainable.

Interim Solution

I suggested that if we were to get an accurate pulse on when launch times occur, it was going to take being told by the application itself. There are techniques we can use to try

I/Gonk ( 1902): Setting nice for pid 1990 to 1
I/Gonk ( 1902): Changed nice for pid 1990 from 18 to 1.
I/GeckoDump( 1902): XXX FIXME : Got a mozContentEvent: activity-choice
I/Gonk ( 1902): Setting nice for pid 2479 to 18
I/Gonk ( 1902): Changed nice for pid 2479 from 18 to 18.
I/Gecko ( 1902): [Parent 1902] WARNING: waitpid failed pid:2479 errno:10: file /home/eli/B2G/gecko/ipc/chromium/src/base/process_util_posix.cc, line 254
I/Gonk ( 1902): Setting nice for pid 2479 to 1
I/Gonk ( 1902): Changed nice for pid 2479 from 18 to 1.
E/[Gralloc-ERROR]( 1902): int gralloc_register_buffer(const gralloc_module_t*, const native_handle_t*):79 Unable to register handle 0x48486290 coming from different process: 1902
E/[Gralloc-ERROR]( 1902): int gralloc_register_buffer(const gralloc_module_t*, const native_handle_t*):79 Unable to register handle 0x48486330 coming from different process: 1902
@eliperelman
eliperelman / gist:9539770
Created March 14, 2014 00:11
OS X: Bash function to change the desktop wallpaper across all monitors and spaces. Tested on Mavericks.
# Usage:
# wallpaper path/to/image.png
function wallpaper() {
image=`echo $(cd $(dirname $1); pwd)/$(basename $1)`
cd /System/Library/CoreServices
sudo rm -f DefaultDesktop.jpg
sudo ln -sf $image DefaultDesktop.jpg
var siteRoutes = {
'login': 'layouts/login',
'index': 'layouts/site'
};
App.ApplicationView = Ember.View.extend({
layoutName: function () {
var currentPath = this.get('controller.currentPath');
if (siteRoutes[currentPath]) {