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
// get an image blob from url using fetch | |
let getImageBlob = function(url){ | |
return new Promise( async resolve=>{ | |
let resposne = await fetch( url ); | |
let blob = resposne.blob(); | |
resolve( blob ); | |
}); | |
}; | |
// convert a blob to base64 |
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
Connect to MongoDb shell | |
--------------------------- | |
mongo "<server-address>/<database>" --username <username> --password <password> | |
MongoDb shell commands | |
--------------------------- | |
Show selected db | |
> db |
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
// works with AST generated by esprima or jsep | |
const Parser = { | |
// 'global' for Node, or any other value for custom scenaros | |
outerscope : 'window', | |
getObservablePaths : function(expression) { | |
console.log('Parser.getPaths',expression); | |
var ast = esprima.parse(expression); | |
if (ast) { |
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 isElementInViewport (el) { | |
var rect = el.getBoundingClientRect(); | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ | |
); |
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
// Addapted from : | |
// https://github.com/tc39/proposal-dynamic-import | |
function importModule(url) { | |
return new Promise((resolve, reject) => { | |
const script = document.createElement("script"); | |
const loaderId = "__tempModuleLoadingVariable" + Math.random().toString(32).substring(2); | |
window[loaderId] = function( m ){ | |
resolve( m ); |
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
/** | |
* The individual bits of 'x' are named b7, b6, b5, b4, b3, b3, b2, b1 and b0. | |
* The bit b7 is the sign bit (the most significant bit), and b0 is the least significant. | |
* x = byte(s) to operate with | |
* n = number of bit to manipulate | |
* v = new value to the bit | |
*/ | |
/** | |
* The idea here is that an integer is odd if and only if the least significant bit b0 is 1. |
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
Most netbooks including the Acer Aspire One (zg5) have a native screen resolution of 1024x600 which can be a pain with some applications that require 1024x768 minimum .. some setting dialogs also seem to be larger than the screen allows. | |
Well you CAN get Peppermint 4 (or any distro based on >= Ubuntu 12.10) to give you 1024x768 | |
This should work for Peppermint 4 .. and possibly for a FULLY updated Peppermint 3 (I can't currently test it in Peppermint 3 .. Ubuntu 12.04 based distros *used* to need a patched version of xorg but I *think* the patch was added in ubuntuupdates) | |
Run this in a terminal: | |
Code: [Select] | |
xrandr --output LVDS1 --panning "1024x768" --scale "1x1.28" |
NewerOlder