This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flip() { | |
let x = Math.floor(Math.random() * 2) | |
if(x = 1) { | |
return "heads" | |
} else { | |
return "tails" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int a = 2; | |
int b = 1; | |
if( a > b){ |