Skip to content

Instantly share code, notes, and snippets.

@sashless
sashless / gist:7201213
Created October 28, 2013 17:41
php array_walk speedtest
Some speed tests
<?php
// Test results
$array1 = test('array_walk');
$array2 = test('array_walk_list_each');
$array3 = test('array_walk_foreach1');
$array4 = test('array_walk_foreach2');
// Check arrays for equal
#!/usr/bin/python
'''
Python implementation of passcode hashing algorithm used on the Samsung Galaxy S4 GT-I9505 4.2.2
Correct PIN for hash and salt below is 1234.
Get 40-character hash value in ascii hex format from file /data/system/password.key on the phone
Get salt in signed numeric format by doing sqlite3 query SELECT value FROM locksettings WHERE name = 'lockscreen.password_salt' on /data/system/locksettings.db
var app = angular.module('scholarApp.controllers');
var NavCtrl = function($scope, $location) {
...
};
// A nicer explicit dependency injection syntax
NavCtrl.$inject = ['$scope', '$location'];
app.controller('NavCtrl', NavCtrl);
(function () {
function MainCtrl ($scope, SomeFactory) {
this.doSometing = function () {
SomeFactory.doSomething();
};
}
angular.module('app').controller('MainCtrl', MainCtrl);
})();
{
  “devices”: {
    “r1sw1″: {
      “protocol”: [ “elro_he_switch” ],
      “id”: [{
        “systemcode”: 14,
        “unitcode”: 1
      }],
 “state”: “off”
window.onload = function() {
var $rootElement = angular.element(window.document);
var modules = [
'ng',
'myApp',
function($provide) {
$provide.value('$rootElement', $rootElement)
}
];
@sashless
sashless / Send infrared commands from the Arduino to the iRobot Roomba
Created January 26, 2016 19:04 — forked from probonopd/Send infrared commands from the Arduino to the iRobot Roomba
Send infrared commands from the Arduino to the iRobot Roomba. Use a transistor to drive the IR LED from pin D3 for maximal range.
#include <IRremote.h>
/*
Send infrared commands from the Arduino to the iRobot Roomba
by probono
2013-03-17 Initial release
@sashless
sashless / virtualwall_irremote.pde
Created January 26, 2016 19:05 — forked from mschmitt/virtualwall_irremote.pde
A trivial Arduino sketch to mimic iRobot Virtual Wall for Roomba
/*
A trivial Arduino sketch to mimic iRobot Virtual Wall for Roomba
----------------------------------------------------------------
Based on information found at:
http://sites.google.com/site/irobotcreate2/createanirbeacon
Uses "A Multi-Protocol Infrared Remote Library for the Arduino":
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
@sashless
sashless / react-some-component.d.ts
Created April 5, 2018 08:53 — forked from vsaarinen/react-some-component.d.ts
How to add TypeScript prop type definitions to an existing React component
import * as React from 'react';
declare class SomeReactComponent extends React.Component<SomeReactComponentProps, any> {}
interface SomeReactComponentProps {
className?: string;
toggle?: boolean;
name: string;
size?: 'lg' | '2x' | '3x' | '4x' | '5x';
}
For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:
First method (override Material UI classnames):
1 - Add the property classes in the AppBar component:
<AppBar classes={{root: 'my-root-class'}}
2 - Override the styles with the styled components:
styled(AppBar)`
&.my-root-class {
z-index: 1500;
}