Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View shlomohass's full-sized avatar
💬
Excited working on a new HUUUGE Idea...

Shlomo Hassid shlomohass

💬
Excited working on a new HUUUGE Idea...
View GitHub Profile
@shlomohass
shlomohass / php_hashing_checksum_performance.php
Last active February 29, 2024 21:54
This test will compare checksum methods with php hashing procedures and some basic ones too -> crc32(), md5(), sha1(), xor(), xor2(), add(). The text is randomly generated each iteration to avoid caching, the test also use several text length that will be different each iteration.
<?php
/*******************************************************************************
* Created by: shlomo hassid.
* Release Version : 1.1
* Creation Date: 02/04/2018
*
* This test will compare checksum methods with php hashing procedures and some
* basic ones to -> crc32(), md5(), sha1(), xor(), xor2(), add().
* The text is randomly generated each iteration to avoid caching, the test also
* use several text length that will be defferent each iteration.
@shlomohass
shlomohass / PHP - Quick and easy pagination function.php
Last active April 26, 2016 17:00
PHP - Quick and easy dynamic pagination function.
<?php
/** Paging function
*
* @param int $max -> results count
* @param int $inter -> display per page
* @param int $cur -> current page
* @param string $link -> base url
* @param string $urlquery -> url query variable name
* @param int $pad -> padding arround current page
@shlomohass
shlomohass / Bootstrap 3 only modals.html
Last active September 30, 2021 14:36
This is an example of the only modals use from bootstrap 3.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Bootstrap Modals only - by shlomo hassid</title>
<script type='text/javascript' src='//code.jquery.com/jquery-1.11.0.js'></script>
<style type='text/css'>
[role="button"] {
cursor: pointer;
}
<script>
//Hidden Fixed header v1.1
//Replace ID below with your box ID
var boxToFix = '#lp-pom-box-88';
//Set the number of pixels to scroll before showing the header
var scrollPositionToShowHeader = 50;
@shlomohass
shlomohass / jQuery-mousewheel-direction-capture.js
Last active October 28, 2022 20:24
jQuery - Get mousewheel scroll event to detect scrolling direction cross browser
$('body').on('mousewheel DOMMouseScroll', function(e){
if(typeof e.originalEvent.detail == 'number' && e.originalEvent.detail !== 0) {
if(e.originalEvent.detail > 0) {
console.log('Down');
} else if(e.originalEvent.detail < 0){
console.log('Up');
}
} else if (typeof e.originalEvent.wheelDelta == 'number') {
if(e.originalEvent.wheelDelta < 0) {
console.log('Down');
@shlomohass
shlomohass / CSV-Parsing-in-PHP.php
Last active August 29, 2015 14:19
PHP Easy Clean An Quick .CSV Import into Array
<?php
/*
Parse CSV into an array:
*/
$csv = array_map('str_getcsv', file('csvfile.csv'));
/*
* OUTPUT: