Skip to content

Instantly share code, notes, and snippets.

var docCookies = {
getItem: function (sKey) {
if (!sKey) { return null; }
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null;
},
setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) {
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; }
var sExpires = "";
if (vEnd) {
@ArnonEilat
ArnonEilat / Gruntfile.js
Created February 6, 2016 12:50
Watch files for changes and copy to other destination
var pathToWatch = 'C:\\Users\\Arnon\\Downloads\\'; // Exploit!!
var copyTo = 'C:\\Users\\Arnon\\Desktop\\tst';
module.exports = function(grunt) {
/**
* Initialize grunt
*/
grunt.initConfig({
watch: {
@ArnonEilat
ArnonEilat / backup.sh
Last active December 21, 2019 20:49
Backup using rsync
#!/bin/bash
ex=''
ex=$ex" --exclude /media/userName/07174FCC5FED4B6F "
ex=$ex" --exclude .adobe "
ex=$ex" --exclude .cordova "
ex=$ex" --exclude .android "
ex=$ex" --exclude android-sdk-linux "
ex=$ex" --exclude tmp "
ex=$ex" --exclude .thumbnails "
Boolean.prototype.toggle = function() {
return !this.valueOf();
}
/**
* @description Parses mixed type values into booleans.
* @param {Mixed} value
* @param {Boolean} nullOnFailure = false
* @return {Boolean}
*/
Boolean.prototype.toBoolean: function(obj) {
@ArnonEilat
ArnonEilat / nice-to-have-bashrc.sh
Last active March 8, 2020 14:27
Nice to have bashrc shortcuts to copy and paste
Black="$(tput setaf 0)"
BlackBG="$(tput setab 0)"
DarkGrey="$(tput setaf 0)"
LightGrey="$(tput setaf 7)"
LightGreyBG="$(tput setab 7)"
White="$(tput setaf 7)"
Red="$(tput setaf 1)"
RedBG="$(tput setab 1)"
LightRed="$(tput setaf 1)"
Green="$(tput setaf 2)"

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@ArnonEilat
ArnonEilat / d3.js
Created May 10, 2014 14:24
d3 line chart with zoom and domain limit.
!function() {
var d3 = {
version: "3.4.5"
};
if (!Date.now) Date.now = function() {
return +new Date();
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
};
@ArnonEilat
ArnonEilat / Array.prototype.js
Last active December 29, 2015 16:29
Array.prototype.js
Array.prototype.insert = function(index, item) {
this.splice(index, 0, item);
};
/***
* var swapTest=['a','b','c'];
* swapTest.swap('a','c')
* @param {type} first
* @param {type} second
@ArnonEilat
ArnonEilat / BinarySearchTree.c
Created January 23, 2013 18:17
Simple C implementation of Binary Search Tree. Usage example included.
#include "BinarySearchTree.h"
/*! \fn Tree * add(Tree *nod , int number)
* \param *nod pointer to <tt>Tree</tt> struct.
* \param number a <tt>int</tt> to add.
* \return pointer to <tt>Tree</tt> struct.
*/
Tree * add(Tree* nod, int number) {
if (nod == NULL) {
nod = (Tree*) malloc(sizeof (Tree));
@ArnonEilat
ArnonEilat / queue.c
Last active December 2, 2021 00:02
Simple C implementation of queue. Usage example included.
#include <stdlib.h>
#include <stdio.h>
#define TRUE 1
#define FALSE 0
/* a link in the queue, holds the info and point to the next Node*/
typedef struct {
int info;
} DATA;