Skip to content

Instantly share code, notes, and snippets.

View cherifGsoul's full-sized avatar
🎯
Focusing

Cherif Bouchelaghem cherifGsoul

🎯
Focusing
View GitHub Profile
package dev.cherifbouchelaghem.vodto.model;
// INSIED THE HEXAGON
public record EmailAddress(String address) {
public static EmailAddress fromString(String address) {
return new EmailAddress(address);
}
}
@cherifGsoul
cherifGsoul / materialize_form_theme.html.twig
Created September 11, 2020 14:52 — forked from JusteLeblanc/materialize_form_theme.html.twig
Symfony2 form theme to integrate Materialize in your Symfony2 forms
{% extends 'form_div_layout.html.twig' %}
{% block form_row -%}
<div class="row{% if (not compound or force_error|default(false)) and not valid %} has-error{% endif %}">
<div class="input-field col s12">
{{- form_widget(form) -}}
{{- form_label(form) -}}
{{- form_errors(form) -}}
</div>
</div>
$base-font-size: 16px;
$base-line-height: 1.5;
$rhythm-line: round($base-font-size * $base-line-height); // in pixels
$caps-height: 0.68;
@function calculate-lines-for-size($font-size) {
// Returns unitless value
@return ceil(($font-size + 0.001) / $rhythm-line);
}
@cherifGsoul
cherifGsoul / index.pug
Last active July 19, 2020 09:40
Vertical rhythm
header.top-bar
.top-bar-brand
a.brand(href="#") brand
aside.sidebar-nav
main.main
h1 Typography
h2 Headings
h1 h1 The quick fox jumps over the lazy dog
h2 h2 The quick fox jumps over the lazy dog
const setNumber = function setNumber(number) {
if (typeof number !== 'string') {
throw new Error('Mobile phone number must be of string value');
}
const normalized = number.replace(/\s|-/g, '');
if (/^(00213|\+213|0)(5|6|7)[0-9]{8}/.test(normalized) === false) {
throw new Error('Invalid phone number');
}
@cherifGsoul
cherifGsoul / android.md
Created October 27, 2019 07:09 — forked from ahmedlhanafy/android.md
Android Cheat Sheet

Android Cheat Sheet

Developer tips

Ripple Effect

android:clickable="true"
android:background="?attr/selectableItemBackground"

or

@cherifGsoul
cherifGsoul / htmlentity.js
Created December 5, 2018 12:53 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
// encode(decode) html text into html entity
var decodeHtmlEntity = function(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
@cherifGsoul
cherifGsoul / emojis.json
Created December 3, 2018 14:44 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_boys", "shortname": "", "unicode": "", "html": "&#128104;&zw
@cherifGsoul
cherifGsoul / RestController.php
Last active November 1, 2018 13:54
Yii simple rest controller exemple
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class RestController extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
@cherifGsoul
cherifGsoul / installvagrant
Created October 15, 2018 09:48 — forked from rrgrs/installvagrant
installs brew, virtualbox, and vagrant in osx
if ! type "brew" > /dev/null; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)";
fi
brew tap phinze/homebrew-cask && brew install brew-cask;
brew cask install vagrant;
brew cask install virtualbox;