Skip to content

Instantly share code, notes, and snippets.

@dherskowitz
dherskowitz / fibonacci.py
Created November 19, 2020 17:34
Common interview functions.
# Do not use any library, just builtin features
# 1 - Create a list by comprehension 0 - 9
# 2 - convert it to a list of strings
# 3 - create a dictionary using the list created on step 1, key = item as string, value = item
# 4 - create a list of elements of Fibonacci series using as input the list created on step 1
# (reference: https://en.wikipedia.org/wiki/Fibonacci_number)
# 5 - sort it descending (don't use builtin reverse)
# 6 - filter it, keep elements < 15
# 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
<div class="relative inline-block text-left" x-data="{ showEventCategoryFilter: false }">
<div @click="showEventCategoryFilter = !showEventCategoryFilter">
<span class="rounded-md shadow-sm">
<button type="button" class="inline-flex justify-center w-full rounded-md border border-gray-300 px-4 py-2 bg-white text-sm leading-5 font-medium text-gray-700 hover:text-gray-500 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-50 active:text-gray-800 transition ease-in-out duration-150" id="options-menu" aria-haspopup="true" aria-expanded="true">
Filter By Category
<svg class="-mr-1 ml-2 h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
</span>
@dherskowitz
dherskowitz / settings.json
Created October 13, 2020 07:54
WIndows Terminal Settings
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":
{
"trailingComma": "es5",
"semicolons": true,
"singleQuote": false,
"bracketSpacing": true,
"tabWidth": 4
}
@dherskowitz
dherskowitz / disable_input.py
Last active August 16, 2021 07:28
Python Scripts
#!/usr/bin/env python3
import os
cmd_get_input = 'xinput --list --id-only "NAME_OF_DEVICE"'
input_id = os.popen(cmd_get_input).read().replace('\n', '')
cmd_disable_input = 'xinput disable ' + input_id
@dherskowitz
dherskowitz / .zshrc
Last active October 7, 2020 12:34
Oh My ZSH Profile
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
ZSH_DISABLE_COMPFIX=true
# Path to your oh-my-zsh installation.
export ZSH="/home/daniel/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
@dherskowitz
dherskowitz / index.html
Last active May 17, 2020 17:48
JS Counters
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS Counters</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="main">
@dherskowitz
dherskowitz / write_text_to_image.php
Created March 3, 2020 15:53
Insert text over image in php
<?php
//Set the Content Type
// header('Content-type: image/png');
// Create Image From Existing File
$png_image = imagecreatefrompng('deal-card.png');
// Allocate A Color For The Text
$white = imagecolorallocate($png_image, 255,255,255);
# send all request to index.php
# -- for php frameworks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
# force www
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var minifyCSS = require('gulp-minify-css');
var merge = require('merge-stream');
var uglify = require('gulp-uglify');
var imagemin = require('gulp-imagemin');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');