Skip to content

Instantly share code, notes, and snippets.

View exodus4d's full-sized avatar

Mark Friedrich exodus4d

View GitHub Profile
@jaseemabid
jaseemabid / objects.js
Created August 23, 2011 13:37 — forked from kaaes/objects.js
ECMA5 object cheatsheet
/**
* Object descriptor
**/
var a = {
prop1 : 14
}
var descriptorObj1 = Object.getOwnPropertyDescriptor(a, 'prop1');
@branneman
branneman / call-apply-bind-proxy.js
Last active February 22, 2024 21:06
JavaScript call() vs apply() vs bind() vs $.proxy()
var fn = function(arg1, arg2) {
var str = '<p>aap ' + this.noot + ' ' + arg1 + ' ' + arg2 + '</p>';
document.body.innerHTML += str;
};
var context = {
'noot': 'noot'
};
var args = ['mies', 'wim'];
// Calls a function with a given 'this' value and arguments provided individually.
@sokratisg
sokratisg / sysctl.conf
Last active January 5, 2024 00:03
Tuned sysctl.conf for use by CentOS/RHEL 6.x or later
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Turn on execshield
# 0 completely disables ExecShield and Address Space Layout Randomization
# 1 enables them ONLY if the application bits for these protections are set to “enable”
# 2 enables them by default, except if the application bits are set to “disable”
# 3 enables them always, whatever the application bits
@taivo
taivo / x-editable-radiolist
Last active March 2, 2019 09:23
radiolist support for x-editable
/**
List of radio buttons. Unlike checklist, value is stored internally as
scalar variable instead of array. Extends Checklist to reuse some code.
@class radiolist
@extends checklist
@final
@example
<a href="#" id="options" data-type="radiolist" data-pk="1" data-url="/post" data-title="Select options"></a>
<script>
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@h2non
h2non / ancestors.js
Created February 6, 2015 18:55
Recursively inspect the prototype chain inheritance of a given object in JavaScript (inspired in Ruby's Class.ancestors)
// Under WTFPL license ;)
function ancestors(obj) {
var hierarchy = [];
if (['boolean', 'number', 'string', 'undefined'].indexOf(typeof obj) !== -1 || obj === null) { // primitives types
obj = Object(obj);
} else if (typeof obj === 'function') {
hierarchy.push(
obj.name ||
(obj.toString().match(/function (\w*)/) ||
obj.toString().match(/\[object (\w*)\]/))[1] ||
@johnantoni
johnantoni / gist:07df65898456ace4307d5bb6cbdc7f51
Last active April 3, 2022 16:31 — forked from mgmilcher/gist:5eaed7714d031a12ed97
Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X

This is my take on how to get up and running with NGINX, PHP-FPM, MySQL and phpMyAdmin on OSX Yosemite.

This article is adapted from the original by Jonas Friedmann. Who I just discovered is from Würzburg in Germany. A stonesthrow from where I was born ;)

Xcode

Make sure you have the latest version of XCode installed. Available from the Mac App Store.

Install the Xcode Command Line Tools:

xcode-select --install

@jesstelford
jesstelford / Links in markdown.md
Last active June 6, 2022 13:56
Putting links in code blocks on GitHub
'use strict';
class Abstract {
// A static abstract method.
static foo() {
if (this === Abstract) {
// Error Type 2. Abstract methods can not be called directly.
throw new TypeError("Can not call static abstract method foo.");
} else if (this.foo === Abstract.foo) {
// Error Type 3. The child has not implemented this method.
throw new TypeError("Please implement static abstract method foo.");
@clue
clue / 2018-04-13 getting-started-with-reactphp-workshop-phpyorkshire.md
Last active December 16, 2023 12:33
Getting started with ReactPHP – Pushing real-time data to the browser (PHPYorkshire)

Think about "PHP" for a few seconds… What came to mind? It’s very likely you thought about your average product catalog, a blogging platform or how the platform is inferior to things like Node.js. But wait, it’s 2018! What if I told you PHP’s huge ecosystem has way more to offer and PHP is not inferior at all to its evil cousin Node.js?

Hands-on workshop given at PHPYorkshire (2018-04-13)

Getting started with ReactPHP – Pushing real-time data to the browser

In this hands-on tutorial you will learn about the core concepts of async PHP and why you too should care about ReactPHP being a real thing. The workshop has a strong focus on sparking the idea that PHP can be way faster and more versatile than you probably thought. Bring along an open mind and through lots of interesting examples and live demos learn why what sounds crazy at first might soon be a valuable addition in your toolbox.

You’re already familiar with PHP and want to learn what ReactPHP is all about? Then this tutorial is for you! We will