Skip to content

Instantly share code, notes, and snippets.

View itsabdessalam's full-sized avatar
🤔
Thinking

Abdessalam Benharira itsabdessalam

🤔
Thinking
View GitHub Profile
@itsabdessalam
itsabdessalam / development.yml
Created August 17, 2020 06:49
development.yml
name: Development workflow
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
@itsabdessalam
itsabdessalam / Store.js
Last active March 3, 2023 17:02
Store mongoose model
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
// On définit le schéma du Store
const StoreSchema = new Schema({
name: {
type: String,
required: true
},
address: {
@itsabdessalam
itsabdessalam / copy.js
Last active September 29, 2020 00:09
Copy to clipboard
// if code snippet is inside input or textarea tags
function copy() {
var codeSnippet = document.querySelector("#code-snippet");
codeSnippet.select();
document.execCommand("copy");
}
document.querySelector("#copy").addEventListener("click", copy);
// if code snippet is inside pre or code tags
function copy() {
@itsabdessalam
itsabdessalam / getDeviceType.js
Last active April 19, 2020 14:38
getDeviceType - Helper to retrieve current device type
/**
* Helper to retrieve current device type
*/
export const getDeviceType = () => {
const ua = navigator.userAgent,
// we could have had several if, a switch with cases, or an object containing keys and values
// by preference and to reduce the process we chose an array of objects containing the type of device and the test
types = [
{
type: "tablet",
name: Production workflow
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: Test workflow
on:
pull_request:
branches:
- master
- staging
jobs:
build:
git branch -m old new
git push origin :old
git push --set-upstream origin new
# alias
alias gmv='mv() { git branch -m $1 $2; git push origin :$1; git push --set-upstream origin $2; }; mv'
@itsabdessalam
itsabdessalam / welcome.png
Last active March 25, 2020 12:16
👋Welcome to my GitHub Profile !
welcome.png
@itsabdessalam
itsabdessalam / getFormData.js
Last active February 18, 2020 07:24
getFormData - Helper to retrieve fields of a form as an object
/**
* Helper to retrieve fields of a form as an object
*/
export const getFormData = form => {
if (!form || form.tagName !== "FORM") {
return;
}
const { elements } = form;
const data = {};
@itsabdessalam
itsabdessalam / sass-7-1-pattern.txt
Created December 19, 2019 09:59
The 7-1 Sass Pattern
sass/
|
|– abstracts/
| |– _variables.scss # Sass Variables
| |– _functions.scss # Sass Functions
| |– _mixins.scss # Sass Mixins
| |– _placeholders.scss # Sass Placeholders
|
|– base/
| |– _reset.scss # Reset/normalize