Skip to content

Instantly share code, notes, and snippets.

Avatar
🏃‍♂️
Learn while you run.

April Mintac Pineda aprilmintacpineda

🏃‍♂️
Learn while you run.
View GitHub Profile
@aprilmintacpineda
aprilmintacpineda / gist:db6239d54909ff044a45ead1bd583cc0
Created Jun 10, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:db6239d54909ff044a45ead1bd583cc0

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@aprilmintacpineda
aprilmintacpineda / myscript.sh
Created May 19, 2018 — forked from bradtraversy/myscript.sh
Basic Shell Scripting
View myscript.sh
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@aprilmintacpineda
aprilmintacpineda / Longest Common Substring & longest consecutive substring.md
Last active Dec 29, 2017
ALGORITHM: Pseudo code for `Longest Common Substring & longest consecutive substring`
View Longest Common Substring & longest consecutive substring.md

Fun with strings!

Longest Common Substring & longest consecutive substring

The idea here is to get the longest common substring of two or more strings. For example, given the strings Heeeeeeeelllllloooo and teeeeeeeestoooo, it will return the string eeeeeeee, because it is the longest common string of the two.

Criteria for deciding if a string is the longest commong substring.

@aprilmintacpineda
aprilmintacpineda / longestConsecutiveSubstr-longestCommonSubstring.js
Created Dec 28, 2017
Longest Common Substring & longest consecutive substring javascript implementation.
View longestConsecutiveSubstr-longestCommonSubstring.js
function longestConsecutiveSubstr(str) {
var longestConsecutiveSubstr = '';
var leftOff = 1;
for (var a = 0; a < str.length - 1; a = leftOff) {
var newLongestConsecutiveSubstr = '';
for (var b = a + 1; b < str.length; b++) {
if (str[a] == str[b]) {
newLongestConsecutiveSubstr += str[a];
@aprilmintacpineda
aprilmintacpineda / fun-with-bubble-sort.md
Last active Dec 27, 2017
Bubble sort implementations in JS, PHP, PY, and Java with tests and performance measurement.
View fun-with-bubble-sort.md

Fun with JS, PHP, PY, and Java

Lots of developers argue about which programming language should be used to do this and that, in reality, all their answers are hugely affected by self bias, most of the time, programmers would use something in favor of something else because of comfortability, they are simply more comfortable using whatever they chose.

All high-level programming languages are pretty much alike, they were built on top of the same concepts, there's MVC in PHP, Java, JavaScript, Python, .NET, etc., they may differ in syntax, but at their very core, they are alike. Much like humans, we differ in color, height, body size, etc., but at our very core, we're all alike, but they differ in terms of speed, like humans differ in intelligence.

So, I made a bubble sort implementation in Java, JavaScript, PHP, and Python. If you don't know the bubble sort algorithm yet and you want to know, then read the [pseudocode](https://gist.github.com/aprilmintacpineda/7800a989f1f494ee8d

@aprilmintacpineda
aprilmintacpineda / bubblesort.java
Last active Dec 24, 2017
bubble sort implementation in Java with tests and performance measurement. I used this for my experiment entitled `fun-with-bubble-sort`.
View bubblesort.java
/**
* NOTE from the developer:
* You only need to manipulate the codes inside the main function, the rest of the codes are
* the core functionality of the program and requires no refactoring
*/
import java.util.Random;
public class TestSuite {
public static void main(String [] args) {
@aprilmintacpineda
aprilmintacpineda / bubblesort.py
Last active Dec 24, 2017
bubble sort implementation in Python with tests and performance measurement. I used this for my experiment entitled `fun-with-bubble-sort`.
View bubblesort.py
# NOTE from the developer:
# You only need to manipulate the codes BELOW, the rest of the codes
# are the core functionality of the program and requires no refactoring
import time
import math
from random import randint
# generates random data for testing purpose
def generateRandomTestData(dataLength, maxNumber):
@aprilmintacpineda
aprilmintacpineda / bubblesort.php
Last active Dec 24, 2017
bubble sort implementation in PHP with tests and performance measurement. I used this for my experiment entitled `fun-with-bubble-sort`.
View bubblesort.php
<?php
$ten = 10;
$hundred = 100;
$thousand = 1000;
$ten_thousand = 10000;
$hundred_thousand = 100000;
$million = 1000000;
// very self-explanatory
@aprilmintacpineda
aprilmintacpineda / bubblesort.js
Last active Dec 24, 2017
bubble sort implementation in JavaScript with tests and performance measurement. I used this for my experiment entitled `fun-with-bubble-sort`.
View bubblesort.js
var ten = 10,
hundred = 100,
thousand = 1000,
ten_thousand = 10000,
hundred_thousand = 100000,
million = 1000000;
// very self-explanatory
// int numberOfTests, int max, int dataLength, boolean showSortedArray = false, runTest = true
doIt(ten, million, million);
@aprilmintacpineda
aprilmintacpineda / bubble-sort-pseudocode.md
Last active Dec 28, 2017
ALGORITHM: Pseudo code for bubble sort. I used this for my experiment entitled `Fun with JS, PHP, PY, and Java`.
View bubble-sort-pseudocode.md

Bubble Sort pseudocode

Bubble sort is composed of two loops, one inside the other, the idea is to push the largest number on the right most side of the list, one by one.

Key factors

For the sake of discussion, we'll call a the outer loop and b the inner loop.

  • a starts at list.length - 1, last step occurs at 0.
  • b starts at 0, last step occurs at a - 1, i.e., if a = 3, then last step of b would be 2.