Skip to content

Instantly share code, notes, and snippets.

yehosef

Block or report user

Report or block yehosef

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yehosef
yehosef / optimization.php
Last active Oct 7, 2018
RF interview followup
View optimization.php
<?php
$series_sizes = [10, 100, 200, 300, 1000, 10000];
//$series_sizes = [10, 100];
$range_max = 3;
foreach ($series_sizes as $series_size)
{
$series_arr[$series_size] = generate_series($series_size, $range_max * -1, $range_max);
View test.sql
set @sum=0;
select mea1_count, num_members, @sum:=@sum+num_members from (
SELECT
mea1_count,
count(mem_id) num_members
FROM (
SELECT
mea1.mem_id,
count(mea1.id) mea1_count
@yehosef
yehosef / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yehosef
yehosef / del_too_small.sh
Last active Aug 29, 2015
delete files smaller than x b
View del_too_small.sh
find . -size -$1b -delete
@yehosef
yehosef / date_dirs.sh
Last active Aug 29, 2015
organized files by date
View date_dirs.sh
#!/bin/bash
years=`seq 2014 2015`
months=`seq -w 01 12`
for year in ${years[@]}; do
mkdir $year
for month in ${months[@]}; do
mkdir $year/$month
mv $year-$month-* $year/$month
done
@yehosef
yehosef / show all color.sh
Last active Aug 29, 2015
show console colors for tmux
View show all color.sh
#!/usr/bin/env bash
for i in {0..255} ; do printf "\x1b[38;5;${i}mcolour${i}\n"; done
@yehosef
yehosef / query.json
Last active Nov 22, 2016
elasticsearch avg problem
View query.json
{
"size": 0,
"query": {
"filtered": {
"query": {
"query_string": {
"query": "*",
"analyze_wildcard": true
}
},
@yehosef
yehosef / es_position_offset_gap_test
Last active Aug 29, 2015
elasticsearch position_offset_gap on objects
View es_position_offset_gap_test
DELETE /test
PUT /test
{
"mappings": {
"nospace": {
"properties": {
"id": {
"type": "integer"
},
@yehosef
yehosef / post-checkout
Last active Dec 19, 2016
git hook to update composer dependencies only if changed, and to put the current revision in a file
View post-checkout
#!/bin/bash
#set -x
githooks/post-checkout-revision.sh
githooks/post-checkout-composer.sh
@yehosef
yehosef / gist:57df0ec37d5096222cf0
Last active Aug 29, 2015 — forked from remy/gist:350433
check for localStorage support and if its not there, make a polyfill based on cookies
View gist:57df0ec37d5096222cf0
// refer to https://gist.github.com/paulirish/5558557
try {
if (!window.localStorage || !window.sessionStorage) throw "exception";
localStorage.setItem('storage_test', 1);
localStorage.removeItem('storage_test');
} catch(e) {
(function () {
var Storage = function (type) {
You can’t perform that action at this time.