Skip to content

Instantly share code, notes, and snippets.

View MoOx's full-sized avatar
:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)

Max Thirouin MoOx

:shipit:
Freelance React / React Native Expert, Cross-platform fanboy (native, web...)
View GitHub Profile
@n1k0
n1k0 / poor-man-text-editor.md
Last active August 29, 2015 13:55
Paste this to your browser url bar

Poor man text editor

Paste this to your browser url bar:

data:text/html,

@madx
madx / test.sh
Last active August 29, 2015 14:04
Test runner with tape + tap-dot
#!/bin/bash
TEST_FILES=`find test/ -name "*.js"`
run_tests() {
local tests="$@"
for test in $tests; do
echo -ne "\033[1;33m$test\033[0m"
tape $test | tap-dot
@thibault
thibault / rexep.pl
Created October 14, 2014 07:15
Monster regexp
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\
@thibault
thibault / internationl_phone_regex.py
Created November 6, 2014 10:58
International phone number validation regex in Python
phone_re = re.compile(r'^\+(999|998|997|996|995|994|993|992|991|'
'990|979|978|977|976|975|974|973|972|971|970|'
'969|968|967|966|965|964|963|962|961|960|899|'
'898|897|896|895|894|893|892|891|890|889|888|'
'887|886|885|884|883|882|881|880|879|878|877|'
'876|875|874|873|872|871|870|859|858|857|856|'
'855|854|853|852|851|850|839|838|837|836|835|'
'834|833|832|831|830|809|808|807|806|805|804|'
'803|802|801|800|699|698|697|696|695|694|693|'
'692|691|690|689|688|687|686|685|684|683|682|'
@MoOx
MoOx / "computed".css
Created July 16, 2015 09:23
custom properties allow more than variables, it's true, but this can provide a similar usage
selector {
prop: value;
}
<?php
class SplClassLoader
{
protected
$includePath = null,
$namespace = null,
$extension = '.php',
$namespaceSeparator = '\\';
// Idea from http://dbaron.org/log/20100424-any
jQuery.expr[':'].any = function(el, i, match) {
return jQuery.find.matches(match[3], [el]).length > 0;
};
jQuery('body :any(div, form) p'); // Same as jQuery('body div p, body form p')
jQuery('div:any(.foo,.bar)'); // Same as jQuery('div.foo, div.bar')
module Sass::Script::Functions
def user_color
color_values = options[:custom][:user].color.
scan(/^#?(..?)(..?)(..?)$/).first.
map {|num| num.ljust(2, num).to_i(16)}
Sass::Script::Color.new(color_values)
end
end
@ralphschindler
ralphschindler / conditional-ternary-eliminate-waste.php
Created March 4, 2011 15:59
Usage of the Conditional Ternary operator to reduce brace and newline waste when processing optional method parameters
<?php
class Coordinate
{
protected $x;
protected $y;
public function __construct($x = null, $y = null)
{
(empty($x)) ?: $this->setX($x);