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 | |
# Simple script to convert markdown to html and apply some basic styles to headings and code snippets | |
# Written for PopOs and other Linux distros using dpkg as package manager | |
# Used for styling Moodle posts written in markdown | |
# pandoc must be installed for this script to work. | |
# first check if pandoc is installed | |
if dpkg -s pandoc | grep -q "install ok installed" | |
then | |
pandoc $1 -f markdown-auto_identifiers -t html -o $2 |
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 imaginaryExponent(exponent) { | |
switch(exponent % 4) { | |
case 1: | |
return 'i'; | |
break; | |
case 2: | |
return -1; | |
break; | |
case 3: | |
return '-i'; |
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
class Quadratic: | |
def __init__(self,a,b,c): | |
self.a = a | |
self.b = b | |
self.c = c | |
self.x_vertex = self.find_x_of_vertex() | |
self.y_vertex = self.find_y_of_vertex() | |
self.vertex = (self.x_vertex,self.y_vertex) | |
self.parabola_direction = self.find_parabola_direction() | |
self.vertex_form = self.find_vertex_form() |
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 | |
# 1. ensure .htaccess has correct re-write rule for index.php | |
if grep -F "$RewriteRule . /index.php [L]" .htaccess; then | |
echo "Default WP rewrite rule detected. \nChanging default WP rewrite rule" | |
sed -i 's/RewriteRule\ \. \/index\.php\ \[L\]/RewriteRule\ \^\(\.\*\)\$\ \/index\.php\/\$1\ \[L\]/' .htaccess | |
fi | |
if grep -F "$RewriteRule ^(.*)$ /index.php/\$1 [L]" .htaccess; then | |
echo "Default WP rewrite rule has been changed. Preventing WP from writing to .htaccess" | |
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 switch_php | |
set input_file ~/devilbox/.env | |
if grep 'PHP_SERVER='$argv $input_file | |
sed -i 's/^PHP_SERVER/#PHP_SERVER/' $input_file | |
sed -i 's/^#PHP_SERVER='$argv'/PHP_SERVER='$argv'/' $input_file | |
grep '^PHP_SERVER*' $input_file | |
else | |
echo "There is no container for PHP " $argv | |
end | |
end |
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
<?php | |
namespace Database\Seeders; | |
use Illuminate\Database\Seeder; | |
use Illuminate\Support\Facades\DB; | |
use ParseCsv\Csv; | |
use Illuminate\Support\Facades\Storage; | |
class PropertySeeder extends Seeder |
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
// Portoflio Assignment Task 1 | |
/*Create a special calculator that read a number from the user, checks that it is an integer and performs a series of mathematical calculations as listed: | |
calculates the number's factorial. A factorial is the product of an integer and all the integers below it; e.g., the factorial of 4 is equal to 24 (4 * 3 * 2 * 1). | |
Calculate the square and cube of the number. A number squared is a number that is multiplied by itself; e.g., 22 is equal to 4 (2 * 2). A number cubed is a number that is multiplied by itself twice e.g., 23 is equal to 8 (2 * 2 * 2). | |
*/ | |
//prevent sloppy code | |
'use strict'; | |
//factorial function, stored outside main function for modularity @link https://codeburst.io/learn-and-understand-recursion-in-javascript-b588218e87ea |