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 deepDiffRight (left, right) { | |
| // if they are equals, return undefined | |
| if (angular.equals(left, right)) return | |
| // form now on, we can assure that `left` and `right` are not equals (equivalents) | |
| // if `left` and `right` are primitives, value changed | |
| // if `left` is a primitive and `right` an object, value has been replaced with an object | |
| // if `left` is an object and `right` a primitive, value has been replaced with a primitive | |
| // use `_.copy` to prevent object referrence issues | |
| if (!angular.isObject(left) || !angular.isObject(right)) return angular.copy(right) |
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
| // launch FM App | |
| navigator.mozApps.mgmt.getAll().onsuccess = function() { | |
| const appId = "app://fm.gaiamobile.org/manifest.webapp"; | |
| var urls = []; | |
| var apps = []; | |
| var targetApp = null; | |
| this.result.forEach(function(app) { | |
| urls.push(app.manifestURL); | |
| apps.push(app); | |
| if (app.manifestURL==appId) { |
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
| struct lua_function functions[] = { | |
| {"get_contact_list", lq_contact_list, { lfp_none }}, | |
| {"get_dialog_list", lq_dialog_list, { lfp_none }}, | |
| {"rename_chat", lq_rename_chat, { lfp_chat, lfp_string, lfp_none }}, | |
| {"send_msg", lq_msg, { lfp_peer, lfp_string, lfp_none }}, | |
| {"send_typing", lq_send_typing, { lfp_peer, lfp_none }}, | |
| {"send_typing_abort", lq_send_typing_abort, { lfp_peer, lfp_none }}, | |
| {"send_photo", lq_send_photo, { lfp_peer, lfp_string, lfp_none }}, | |
| {"send_video", lq_send_video, { lfp_peer, lfp_string, lfp_none }}, | |
| {"send_audio", lq_send_audio, { lfp_peer, lfp_string, lfp_none }}, |
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 my_jenv = null; | |
| try { | |
| my_jenv = JNI.GetForThread(); | |
| // We declare the classes, methods, etc we will be using: this part is not seen in the native example | |
| var SIG = { | |
| CharSequence: 'Ljava/lang/CharSequence;', | |
| Context: 'Landroid/content/Context;', | |
| GeckoAppShell: 'Lorg.mozilla.gecko.GeckoAppShell;', | |
| Toast: 'Landroid/widget/Toast;', // can use .'s or /'s so `android.widget.Toast` and `android/widget/Toast` both work // from docs page header http://developer.android.com/reference/android/widget/Toast.html#makeText%28android.content.Context,%20int,%20int%29 |
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
| # save it as /etc/profile.d/ssh-telegram.sh | |
| # use jq to parse JSON from ipinfo.io | |
| # get jq from here http://stedolan.github.io/jq/ | |
| USERID="<target_user_id>" | |
| KEY="<bot_private_key>" | |
| TIMEOUT="10" | |
| URL="https://api.telegram.org/bot$KEY/sendMessage" | |
| DATE_EXEC="$(date "+%d %b %Y %H:%M")" | |
| TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt' | |
| if [ -n "$SSH_CLIENT" ]; then |
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
| # npm publish with goodies | |
| # prerequisites: | |
| # `npm install -g trash conventional-recommended-bump conventional-changelog conventional-github-releaser conventional-commits-detector json` | |
| # `np` with optional argument `patch`/`minor`/`major`/`<version>` | |
| # defaults to conventional-recommended-bump | |
| # and optional argument preset `angular`/ `jquery` ... | |
| # defaults to conventional-commits-detector | |
| np() { | |
| travis status --no-interactive && | |
| trash node_modules &>/dev/null; |
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 name = "lightweightThemes.selectedThemeID"; | |
| var selectedThemeID = require("sdk/preferences/service").get(name); | |
| var button = ToggleButton({ | |
| id: "btcven", | |
| label: "btcven", | |
| icon: { | |
| "16": selectedThemeID === "[email protected]" ? "./icondev16.svg" : "./icon16.svg", | |
| "32": "./icon32.svg", | |
| "64": "./icon64.svg" |
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
| { | |
| "time": { | |
| "timestamp": 1433094852 | |
| }, | |
| "BTC": { | |
| "USD": 232.2685, | |
| "EUR": 211.7692, | |
| "VEF": 82216.080945, | |
| "ARS": 2949.80995, | |
| "LTC": "139.86013986", |
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
| Components.utils.import("resource://gre/modules/ctypes.jsm"); | |
| Components.utils.import("resource://gre/modules/Services.jsm"); | |
| // Or using Services.jsm and Ci = Components.interfaces | |
| var file = Components.classes["@mozilla.org/file/directory_service;1"]. | |
| getService(Components.interfaces.nsIProperties). | |
| get("CurProcD", Components.interfaces.nsIFile); | |
| // Append the file name. |
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 usbhid(vendor_id, product_id) { | |
| this.product_id = product_id; | |
| this.vendor_id = vendor_id; | |
| this.buffer_1 = new Object(); | |
| this.buffer_2 = new Object(); | |
| this.xpcom = Components.classes["@firechip.info/hidapi;1"].createInstance().QueryInterface(Components.interfaces.nsIHid); | |
| this.manufacturer_string = function() { | |
| alert(this.xpcom.manufacturer_string); | |
| } | |
| this.product_string = function() { |