Skip to content

Instantly share code, notes, and snippets.

View ptomasroos's full-sized avatar

Tomas Roos ptomasroos

View GitHub Profile
@ptomasroos
ptomasroos / remove.txt
Created September 11, 2015 13:30
Remove program entries in i3 dmenu
To remove a program in the i3 dmenu just pipe the result from dmenu_path in the /usr/bin/dmenu_run
dmenu_path | awk '!/zsh/' | .......
would remove zsh.
componentWillReceiveProps(nextProps) {
if (nextProps.lastRequestedUserLocationAt > this.props.lastRequestedUserLocationAt) {
this.centerMapToUser(nextProps.currentLocation);
}
if (nextProps.lastUpdated > this.props.lastUpdated) {
const markers = this.createMarkersForLocations(nextProps);
if (markers && Object.keys(markers)) {
const clusters = {};
@ptomasroos
ptomasroos / gist:9cd64ad6513fca9ae170028ecbbd7ffd
Created January 30, 2017 12:19
Prevent slow console logging in RN production apps
// this guards against console usage in production builds since
// babel transform of remove console won't work with react-native preset
if (!__DEV__) {
['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception',
'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'profile', 'profileEnd',
'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn'].forEach(
(methodName) => {
console[methodName] = () => { /* noop */ };
});
}
@ptomasroos
ptomasroos / gist:39070d1799addecd5b3288e5bc85068e
Created November 29, 2017 12:12
uBlock GPT base64 object
(function() {
var p;
// https://developers.google.com/doubleclick-gpt/reference
var noopfn = function() {;
}.bind();
var noopthisfn = function() {
return this;
};
var noopnullfn = function() {
return null;