Skip to content

Instantly share code, notes, and snippets.

View Eyal-Shalev's full-sized avatar

Eyal Halpern Shalev Eyal-Shalev

View GitHub Profile
@Eyal-Shalev
Eyal-Shalev / fiber_fork.rb
Last active December 18, 2019 12:36
ruby fiber fork
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 August 18, 2024 23:41
DAMP - Docker Apache MySQL PHP setup

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 June 7, 2016 19:41
An example form object (Drupal 8) that combines multiple forms into itself.
<?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 11:24
This is a Drupal 8 utilities service to help update entity fields.
<?php
/**
* @File
* Contains \Drupal\foo\EntityUpdater.
*/
namespace Drupal\foo;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Query\Condition;
/**
* @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 September 6, 2015 19:47 — forked from dezinezync/scroll.easing.js
Vanilla Javascript scrolling object
'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 November 23, 2014 19:26
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
// COLORS
// FUNCTIONS
// Returns the hex color key of a named color.