Skip to content

Instantly share code, notes, and snippets.

Avatar

Eyal Halpern Shalev Eyal-Shalev

View GitHub Profile
@Eyal-Shalev
Eyal-Shalev / fiber_fork.rb
Last active Dec 18, 2019
ruby fiber fork
View fiber_fork.rb
require 'eventmachine'
require 'em-synchrony'
fiber_fork = ->(cmd) {
f = Fiber.current
Fiber.new {
reader, writer = IO.pipe
fork {
reader.close
@Eyal-Shalev
Eyal-Shalev / DAMP - Docker-Apache-MySQL-PHP.md
Last active Feb 15, 2022
DAMP - Docker Apache MySQL PHP setup
View DAMP - Docker-Apache-MySQL-PHP.md

DAMP - Setup an Apache, MySQL & PHP local server using Docker

Prerequisites

Setup

  1. Create a new directory for your local server (MY_APP is used as a placeholder)
  2. Add docker-compose.yml, Dockerfile and nginx.conf files to the root of your server directory.
  3. With your favorite terminal application:
@Eyal-Shalev
Eyal-Shalev / ComboForm.php
Created Jun 7, 2016
An example form object (Drupal 8) that combines multiple forms into itself.
View ComboForm.php
<?php
namespace Drupal\sandbox\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\user\Entity\User;
@Eyal-Shalev
Eyal-Shalev / EntityUpdater.php
Created May 19, 2016
This is a Drupal 8 utilities service to help update entity fields.
View EntityUpdater.php
<?php
/**
* @File
* Contains \Drupal\foo\EntityUpdater.
*/
namespace Drupal\foo;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Query\Condition;
View ClassFactory.js
/**
* @file
* @fileOverview Provides a Factory function for creating classes and a base Class object.
* @author Eyal (github.com/Eyal-Shalev)
* @version 0.1
*/
(function () {
'use strict';
@Eyal-Shalev
Eyal-Shalev / scroller.js
Last active Sep 6, 2015 — forked from dezinezync/scroll.easing.js
Vanilla Javascript scrolling object
View scroller.js
'use strict';
/*
* Based on work done by Nikhil Nigade (@dezinezync) https://gist.github.com/dezinezync/5487119
*/
(function () {
var DEFAULT_ELEMENT = document.documentElement.scrollTop ? document.documentElement : document.body;
var REQUEST_ANIMATION_FRAME = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.oRequestAnimationFrame;
@Eyal-Shalev
Eyal-Shalev / SassMeister-input.scss
Created Nov 23, 2014
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
// COLORS
// FUNCTIONS
// Returns the hex color key of a named color.