Skip to content

Instantly share code, notes, and snippets.

@oriadam
oriadam / closest-test-for-jsperf.html
Last active December 5, 2017 13:59
jsPerf closest
<!DOCTYPE html>
<html>
<head>
<style>
name {
display: inline-block;
width: 200px;
}
@oriadam
oriadam / colorValues.js
Last active February 9, 2024 16:01
javascript convert any color to array of rgba values
// return array of [r,g,b,a] from any valid color. if failed returns undefined
function colorValues(color)
{
if (!color)
return;
if (color.toLowerCase() === 'transparent')
return [0, 0, 0, 0];
if (color[0] === '#')
{
if (color.length < 7)
@oriadam
oriadam / tremp.user.js
Last active May 9, 2020 16:24
tremp tel hai user script
// ==UserScript==
// @name לוח טרמפים בלי חפשנים
// @namespace https://www.facebook.com
// @version 3
// @author You
// @match https://www.facebook.com/groups/198031415602/*
// @grant unsafeWindow
// @updateURL http://softov.org/tremp.user.js
// @downloadURL http://softov.org/tremp.user.js
// ==/UserScript==
// ==UserScript==
// @name The Facebook Limiter
// @namespace http://tampermonkey.net/
// @version 4
// @description Helps in your goals to limit the use of youtube/facebook to 1 hour. Edited by Oria.
// @author theKidOfArcrania
// @include http*://www.facebook.com*
// ==/UserScript==
/* jshint -W097 */
'use strict';
@oriadam
oriadam / onandnow.jquery.js
Created October 20, 2019 16:24
add jQuery functionality `onAndNow` to add event listener and execute it once.
// call the handler now and on events
jQuery.fn.extend({
onAndNow: function(events, func) {
// TODO: Support the data object
return this.each(func).on(events, func);
}
});
@oriadam
oriadam / exercise item list.txt
Last active February 11, 2021 13:27
simple PHP mission
1. create a mysql db with the following tables:
items
item_id name category_id
categories
category_id name
2. add some initial categories and items.
3. create an html page that displays the items grouped by category (any interpretation is fine).
4. add a way to add new items. the item should also be added to the page instantly (ajax/SPA).
picture codenames:
https://codenames.dport.me/
enter this url below
https://gist.github.com/oriadam/3b77af6f9c5e941f9586b0ff0e698acd/raw/b4a75b0ce6597ee0eef63ee68b730525e596f79f/links-to-images.txt
go to options and set 'strech' off, 'expand' on
word codenames:
https://www.horsepaste.com
turn off the english dictionary then turn on the hebrew one
@oriadam
oriadam / isAssocArrayBench.php
Last active May 19, 2021 10:43 — forked from Thinkscape/isAssocArrayBench.php
A benchmark of several methods for checking if PHP array is associative
<?php
$iterations = $argv[1] ?: 10000;
/**
* Arrays to check
*/
$tests = array(
array(array(
'foo' => 'bar',
)),
array(array(
@oriadam
oriadam / hdmi_audio.desktop
Created February 19, 2022 18:20
linux mint set audio output to hdmi
[Desktop Entry]
Version=1.0
Type=Application
Name=hdmi audio
Comment=
Exec=pactl set-card-profile 0 output:hdmi-stereo
Icon=
Path=
Terminal=false
StartupNotify=false