Skip to content

Instantly share code, notes, and snippets.

View slimani-dev's full-sized avatar
🏠
Working from home

Mohamed slimani-dev

🏠
Working from home
View GitHub Profile
@slimani-dev
slimani-dev / MainActivity.java
Created October 25, 2020 20:20
A simple android calculator (XML + JAVA)
package com.example.calculator;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
function flip() {
let x = Math.floor(Math.random() * 2)
if(x = 1) {
return "heads"
} else {
return "tails"
}
}
@slimani-dev
slimani-dev / nginx_server.sh
Created November 3, 2019 11:14
Generate Laravel Configuration file for nginx server
#!/bin/bash
if [[ $EUID > 0 ]]; then # we can compare directly with this syntax.
echo "Please run as root/sudo"
exit 1
else
if test -z "$1"; then
PROJECT=${PWD##*/}
DIR="$PWD"
else
@slimani-dev
slimani-dev / booleans.js
Created January 23, 2018 14:45 — forked from beoliver/booleans.js
javascript boolean matches (and / nand / or / nor / xor / iff / all / any / none )
function id(x) {
// id :: a -> a
return x }
function anyBool(pred,bool,xs) {
/* a better name would be - if predicate is True then bool, else not bool.
using basic logic we can now create logic functions that compute only as much as required */
// anyBool :: (a -> Bool) -> Bool -> [a] -> Bool
for (var i = 0; i < xs.length; i++) {
if (pred(xs[i]) === bool) {
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 2;
int b = 1;
if( a > b){