Skip to content

Instantly share code, notes, and snippets.

View barzik's full-sized avatar

Ran Bar-Zik barzik

View GitHub Profile
// console.lol by @RonnyOrbach, idea by Erez Avny
if (typeof console != 'undefined') console.lol = function(){
var args = [].slice.call(arguments, 0);
args.unshift("LOL");
args.push("LOLOLOL!")
console.log.apply(console, args);
};
@barzik
barzik / doppelganger.user.js
Last active December 12, 2015 03:28
Anti-doppelganger Grease Monkey script
// ==UserScript==
// @name Anti-doppelganger ver 1.3
// @namespace http://internet-israel.com
// @description Remove doppelganger week from my fucking feed
// @grant none
// @include https://www.facebook.com/*
// @include http://www.facebook.com/*
// @require http://code.jquery.com/jquery.js
// ==/UserScript==
@barzik
barzik / .gitconfig
Last active August 30, 2021 13:22
Recommended git alias list
#Based on http://haacked.com/archive/2014/07/28/github-flow-aliases/
[alias]
co = checkout
ec = config --global -e
up = !git pull --rebase --prune $@ && git submodule update --init --recursive
cob = checkout -b
cm = !git add -A && git commit -m
save = "!f(){ ARG1=${1:-SAVEPOINT}; git add -A && git commit -m \"$ARG1\"; };f"
wip = !git add -u && git commit -m "WIP"
@barzik
barzik / maxlengthescaped.js
Last active March 27, 2016 13:44
The max-length-escaped directive testing the length against escaped value. Prevent sending exceeding escaped length input to server\API that enforce size.
/**
* The max-length-escaped directive testing the length against escaped
* value. Prevent sending exceeding escaped length input to server\API that enforce size.
*
* Usage:
* <input type="text" max-length-escaped="250" /> || <textarea max-length-escaped="1000"></textarea>
*
* License: MIT
*/
@barzik
barzik / fix-all.bat
Last active August 9, 2016 09:04
bat file to eslint fix all the files in a sample project
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\client\.eslintrc C:\PROJECT\client\app\**\*.js --ignore-pattern *.spec.js --fix
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\client\.eslintrc-spec C:\PROJECT\client\app\**\*.spec.js --fix
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\server\.eslintrc C:\PROJECT\server\app\**\*.js --ignore-pattern *.spec.js --fix
call C:\Users\USER\AppData\Roaming\npm\eslint -c C:\PROJECT\server\.eslintrc-spec C:\PROJECT\server\app\**\*.spec.js --fix
@barzik
barzik / pageObjectExample.js
Created September 24, 2016 07:47
Page Object Exanmple
'use strict';
var myPage = function () {
browser.driver.manage().window().maximize();
};
myPage.prototype = Object.create({}, {
loadingBarSettings: { get: function () { return element(by.xpath('//div[@class="snake-foreground"]/div[3]')); } },
productNameHeader: { get: function () { return element(by.css('h2.ng-binding')); } },
productContentOwnersButton: { get: function () { return element(by.xpath('//span[contains(@class, "my-badge-text") and text() = "Content Owners"]')); } },
@barzik
barzik / add-ignore.js
Created November 6, 2016 15:38
Adding ignore remark for to CSS\JS files
/* eslint-disable angular/log,no-console,angular/json-functions,no-loop-func */
const fs = require('fs');
const glob = require('glob');
const pathToFiles = './src/**/*.less';
const disableString = '/* stylelint-disable */';
const files = glob.sync(pathToFiles, { cwd: './', realpath: true });
for (const file of files) {
const content = fs.readFileSync(file, 'utf8');
@barzik
barzik / load-google-analytics-in-webpack.js
Created December 20, 2018 13:24
How to load Google Analytics without Google script with webpack
const analyticsId = 'XX-XXXXXX';
window.ga = window.ga || ((...args) => (ga.q = ga.q || []).push(args));
ga('create', `UA-${analyticsId}-Y`, 'none');
const gaLoader = document.createElement('script');
gaLoader.src = 'https://www.google-analytics.com/analytics.js';
gaLoader.async = true;
document.querySelector('head').appendChild(gaLoader);
@barzik
barzik / internet-monitor-node-red
Last active January 29, 2022 19:58
Internet Monitor for Raspberry Pi and Sensor HAT
[
{
"id": "fee7a583aa5c9a4b",
"type": "tab",
"label": "Internet Monitor",
"disabled": false,
"info": "",
"env": []
},
{
[
{
"id": "a48e0b927d58bcd2",
"type": "tab",
"label": "Wordle Generator",
"disabled": false,
"info": "",
"env": []
},
{