Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Bogdan Bivolaru bogdanbiv

💭
I may be slow to respond.
View GitHub Profile
@bogdanbiv
bogdanbiv / Readme.md
Last active Feb 25, 2018
Another description for this gist
View Readme.md

My dynamic gist.

View bitSmearing.js
// https://codegolf.stackexchange.com/questions/151537/alternating-bit-smearing
// CodeGolf - alternating bit smearing over trailing 00 for numbers in base 2
smear = function (num) {
const old = num;
let replaces = 0, remind = num%4===0, supl = 0;
while (remind) {
console.log(remind);
remind?replaces++:0;
@bogdanbiv
bogdanbiv / .gitignore
Last active Aug 29, 2015
Reloading Connect/Express server code using grunt-contrib-watch and reload option
View .gitignore
*~
node_modules
View ba-objecttotype.js
// See http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/
(function(global) {
// Maintain a map of already-encountered types for super-fast lookups. This
// serves the dual purpose of being an object from which to use the function
// Object.prototype.toString for retrieving an object's [[Class]].
var types = {};
// Return a useful value based on a passed object's [[Class]] (when possible).
Object.toType = function(obj) {
@bogdanbiv
bogdanbiv / Circular Safe Object Inspector
Created Oct 12, 2014
Serialize object keys and values except values that are arrays or other objects. This is to be used in case JSON.stringify fails due to cyclic...
View Circular Safe Object Inspector
function mystringify(input) {
var key, type, retVal = "";
for(key in input) {
if (input.hasOwnProperty(key)) {
type = typeof(input[key]);
if (type === 'array' || type === 'object') {
retVal += key + ": " + type + ", ";
} else {
retVal += key + ": " + input[key] + ", ";
}
@bogdanbiv
bogdanbiv / jitsu_deploy_shell
Last active Dec 15, 2015
Application cannot start because in the start.sh script some symbols are not recognised: dot = error,
View jitsu_deploy_shell
info: Welcome to Nodejitsu bogdanb
info: jitsu v0.12.7, node v0.8.14
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Skipping require-analyzer because noanalyze option is set
info: Skipping require-analyzer because noanalyze option is set
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /home/bogdanbiv/WebstormProjects/life-trackr/package.json
data:
@bogdanbiv
bogdanbiv / IsolateRootCause
Last active Dec 15, 2015
Question: Check line 711 will have a error about not finding nasm (Netwide Assembler) in file NPM_install_console_log. Even better check line 455 in file New_NPM_install_console_log and see that it contains the same nasm error, clearly unrelated to tap. What do webapps have to do with "nasm (Netwide Assembler)"? Steps to reproduce: * Install Yeo…
View IsolateRootCause
bogdanbiv@bogdanbiv-P35-DS3:~/WebstormProjects$ mkdir npmtest
bogdanbiv@bogdanbiv-P35-DS3:~/WebstormProjects$ cd npmtest/
bogdanbiv@bogdanbiv-P35-DS3:~/WebstormProjects/npmtest$ npm install jpegtran-bin
npm http GET https://registry.npmjs.org/jpegtran-bin
npm http 304 https://registry.npmjs.org/jpegtran-bin
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/colors
npm http 304 https://registry.npmjs.org/which
You can’t perform that action at this time.