sudo apt-get install heimdall{,-frontend}
sudo apt-get install android-tools-adb
sudo apt-get install build-essential cmake zlib1g-dev qt5-default libusb-1.0-0-dev libgl1-mesa-glx libgl1-mesa-dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Twins(a, b) { | |
| var result = Array(a.length), | |
| swap = function(arr, index) { | |
| var tmp = arr[index]; | |
| arr[index] = arr[index + 2]; | |
| arr[index + 2] = tmp; | |
| return arr; | |
| }, | |
| swapBack = function(str, index) { | |
| var arr = str.split(''); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$ | |
| DECLARE | |
| channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes'); | |
| BEGIN | |
| IF TG_OP = 'INSERT' THEN | |
| PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}'); | |
| RETURN NEW; | |
| END IF; | |
| IF TG_OP = 'DELETE' THEN | |
| PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Here is a function that I use all the time when creating public | |
| // async APIs in JavaScript: | |
| const resolvePromise = (promise, callback) => { | |
| if (callback) | |
| promise.then(value => callback(null, value), callback) | |
| return promise | |
| } | |
| // Sometimes I like to use callbacks, but other times a promise is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from "React"; | |
| export default (ComposedComponent) => class extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This function: | |
| function foo() { | |
| var x = 5; | |
| var y = 6; | |
| debugger; | |
| return x + y; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Expects an array of scores from 0-10 | |
| // Example: nps([10, 9, 10, 4]); -> 50 | |
| // See http://www.medallia.com/net-promoter-score/ | |
| function nps(scores) { | |
| var promoters = 0; | |
| var detractors = 0; | |
| for (var i=0, l=scores.length; i<l; i++) { | |
| if (scores[i] >= 9) promoters++; | |
| if (scores[i] <= 6) detractors++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var React = require('react'); | |
| var cx = require('classnames'); | |
| var vjs = require('video.js'); | |
| var _forEach = require('lodash/collection/forEach'); | |
| var _debounce = require('lodash/function/debounce'); | |
| var _defaults = require('lodash/object/defaults'); | |
| var DEFAULT_HEIGHT = 800; | |
| var DEFAULT_WIDTH = 600; | |
| var DEFAULT_ASPECT_RATIO = (9 / 16); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // app/transforms/array.js | |
| import Ember from 'ember'; | |
| import DS from 'ember-data'; | |
| export default DS.Transform.extend({ | |
| deserialize: function(value) { | |
| if (Ember.isArray(value)) { | |
| return Ember.A(value); | |
| } else { | |
| return Ember.A(); |
NewerOlder