Skip to content

Instantly share code, notes, and snippets.

View bogdanpetru's full-sized avatar
🍓

Bogdan bogdanpetru

🍓
View GitHub Profile
$.fn.makeEqual = function(){
var self = this,
heights = $.map(this, function(el){return $(el).height();}),
heighestHeight = Math.max.apply(null, heights);
this.removeHeight = function(){
$.each(self, function(i, el){
$(el).css("min-height", "");
});
};
var fs = require('fs');
var http = require('http');
var ROOT = '/';
var dataString1 = "img1,img2,img3";
function download(list, index){
var file = list[index].trim();
var url = ROOT + file;
@bogdanpetru
bogdanpetru / shuffle array js
Last active December 9, 2015 21:55
recurse shuffle array
function shuffle(list){
if(list.length === 1){
return list;
}
let min = 0;
let max = list.length - 1;
let randomIndex = Math.floor(Math.random() * (max - min + 1)) + min;
Make it run, then make it right, then make it fast
@bogdanpetru
bogdanpetru / keysEqual.js
Last active June 16, 2016 08:34
Determines if two objects are equal based a list of keys
/**
* Determines if two objects are equal based on a list of keys
*
* object1, object2: Object
* keys: Array
*/
function keysEqual(object1, object2, keys) {
for (let i = 0, len = keys.length; i < len; i++) {
const key = keys[i];
// if one key is not euqal then the two objets are not equal
@bogdanpetru
bogdanpetru / markdown-anchor-parse
Created September 26, 2016 13:59
Parses text with anchor like markdown text
var re = /\[(.+?)]\((.+?)\)/ig;
var str = '[Mihaela Popescu](popover://contact/891) vezi [CE1211](popover://ask/21)';
var m;
var foundMatches = []
var result = [str]
while ((m = re.exec(str)) !== null) {
// every m looks like this
// ["[Mihaela Popescu](popover://contact/891)", "Mihaela Popescu", "popover://contact/891"]
68034 silly gunzTarPerm modified mode [ 'node_modules/rc/LICENSE.MIT', 420, 436 ]
68035 silly gunzTarPerm extractEntry node_modules/rc/lib/utils.js
68036 silly gunzTarPerm modified mode [ 'node_modules/rc/lib/utils.js', 420, 436 ]
68037 silly gunzTarPerm extractEntry node_modules/rc/LICENSE.BSD
68038 silly gunzTarPerm modified mode [ 'node_modules/rc/LICENSE.BSD', 420, 436 ]
68039 silly gunzTarPerm extractEntry node_modules/rc/test/ini.js
68040 silly gunzTarPerm modified mode [ 'node_modules/rc/test/ini.js', 420, 436 ]
68041 silly gunzTarPerm extractEntry node_modules/rc/test/nested-env-vars.js
68042 silly gunzTarPerm modified mode [ 'node_modules/rc/test/nested-env-vars.js', 420, 436 ]
68043 silly gunzTarPerm extractEntry node_modules/rc/test/test.js
var exec = require('child_process').exec;
var command1 = `ls -l`
var command2 = `ls`
var command3 = `cd ..`
var intervalCommand1 = ( // 10 ore
1000 * 10
// 60 * // sec
// 60 * // min
// 10 // ore
var exec = require('child_process').exec;
var command1 = `ls -l`
var command2 = `ls`
var command3 = `cd ..`
var intervalCommand1 = ( // 10 ore
1000 *
60 * // sec
60 * // min
10 // ore
var exec = require('child_process').exec;
var command1 = `ls -l`
var command2 = `ls`
var command3 = `cd ..`
var intervalCommand1 = ( // 10 ore
1000 * 60 * 2
// 60 * // sec
// 60 * // min
// 10 // ore