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 / welcome.png
Last active March 25, 2020 12:16
👋Welcome to my GitHub Profile !
welcome.png
@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: {
StoreSchema.statics.findByCoordinates = function(coordinates, maxDistance) {
return this.aggregate([
{
$geoNear: {
near: {
type: "Point",
coordinates: coordinates
},
maxDistance: maxDistance,
distanceField: "dist.calculated",
@itsabdessalam
itsabdessalam / extensions.txt
Last active December 17, 2019 06:31
vscode config
code --install-extension anthonydiametrix.ACF-Snippet
code --install-extension bierner.markdown-preview-github-styles
code --install-extension bmewburn.vscode-intelephense-client
code --install-extension bungcip.better-toml
code --install-extension ChakrounAnas.turbo-console-log
code --install-extension christian-kohler.npm-intellisense
code --install-extension christian-kohler.path-intellisense
code --install-extension cjhowe7.laravel-blade
code --install-extension cmstead.jsrefactor
code --install-extension CoenraadS.bracket-pair-colorizer
@itsabdessalam
itsabdessalam / getTopWindow.js
Created December 17, 2019 07:27
getTopWindow - helper to retrieve the topmost window
/**
* Helper to retrieve the topmost window
*/
export const getTopWindow = () => {
let w = window;
if (window.top) w = window.top;
else
while (w.parent) {
w = w.parent;
}
@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
@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 = {};
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 / 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: Test workflow
on:
pull_request:
branches:
- master
- staging
jobs:
build: