Skip to content

Instantly share code, notes, and snippets.

@callmephil
callmephil / button_with_shadow.dart
Last active February 10, 2023 22:22
button with shadow
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@callmephil
callmephil / cleaner.js
Last active November 19, 2020 13:34
countries-json-simple
'use strict'
/*
This script can be used with nodejs to convert the larger json file into a smaller one
ref*: https://gist.githubusercontent.com/callmephil/d9b8ac5dc03a325c01bfd5a5bf661816/raw/a1b0ad0565ce1d70c783e98187ebdf6b28942a71/countries.json
*/
const fs = require('fs');
const jsonData = require('./countries.json');
@callmephil
callmephil / countries.json
Created November 19, 2020 11:13
Countries-unsorted
{
"success": true,
"result": [{
"name": "Afghanistan",
"topLevelDomain": [".af"],
"alpha2Code": "AF",
"alpha3Code": "AFG",
"callingCodes": ["93"],
"capital": "Kabul",
"altSpellings": ["AF", "Afġānistān"],
@callmephil
callmephil / media-query.css
Created March 20, 2020 17:53 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@callmephil
callmephil / README.md
Last active January 16, 2020 12:34
SQLite - Check Contraints

SQLite - Check Contraints

Prelude:

  • Rule 1. I do not trust the backend.
  • Rule 2. I do not trust the frontend.
  • Rule 3. I and only I decide what should I store or not.

When managing a database you want to remember the three rules above. As we do not know which silly magic is used to fill the data in our database we need to ensure the integrity of our data. defining a data type (text, integer, date) is not secure enough. So most database manager (MySql, SQLite, MariaDB) use CHECK Constraints. It is a simple process to verify that the inputs fits the requirements of your app before inserting any data in your tables.

Important: CHECK(...) behave like if constraints which means you can perfom any operations within the parenthesis.

@callmephil
callmephil / spell_generic.cpp
Created December 18, 2019 23:08
spell_generic
class spell_gen_mount : public SpellScriptLoader
{
public:
spell_gen_mount(char const* name, uint32 mount0 = 0, uint32 mount60 = 0, uint32 mount100 = 0, uint32 mount150 = 0, uint32 mount280 = 0, uint32 mount310 = 0) : SpellScriptLoader(name),
_mount0(mount0), _mount60(mount60), _mount100(mount100), _mount150(mount150), _mount280(mount280), _mount310(mount310) { }
class spell_gen_mount_SpellScript : public SpellScript
{
PrepareSpellScript(spell_gen_mount_SpellScript);
"use strict";
const EMOJI = [
{
sentiment: "joy",
expression: {
extreme: "😂",
medium: "🙂",
slightly: "😄",
neutral: "🙂"
@callmephil
callmephil / dasd.js
Created October 16, 2019 23:42
dasd
const getDaysDiff = (start_date, end_date, date_format = 'YYYY-MM-DD') => {
const getDateAsArray = (date) => {
return moment(date.split(/\D+/), date_format);
}
return getDateAsArray(end_date).diff(getDateAsArray(start_date), 'days') + 1;
}
@callmephil
callmephil / Sidebar.css
Created January 20, 2019 17:41
Sidebar-React
@import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
@import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
.fa-2x {
font-size: 2em;
}
.fa {
position: relative;
@callmephil
callmephil / techwatchlist
Last active January 16, 2019 09:58
techlist
Phil 21/01/2019,
Imad 22/01/2019,
Mario 23/01/2019,
Adel 24/01/2019,
Patricia 25/01/2019,
Mario 28/01/2019,
Imad 29/01/2019,
Ala'a 30/01/2019,
Hussein.H 31/01/2019,
Imad 01/02/2019,