Skip to content

Instantly share code, notes, and snippets.

View ephbaum's full-sized avatar

Eph Baum ephbaum

View GitHub Profile
@ephbaum
ephbaum / click-click-click.js
Created May 5, 2015 19:49
click click click
// test a
var $testContainer = $('.test-container'), elem = $( '<p class="test_jquery_click">Test Elem</p>' ), counterArray = [];
$testContainer.text('');
for (var i = 50; i >= 0; i--) { $testContainer.append( elem ); }
$('p.test').click( function(e) { counterArray.push($(this)); });
$('.test-container > p.test_jquery_click').each(function() {$(this).click();});
console.dir( $testContainer );
//test b
var $testContainer = $('.test-container'), elem = $( '<p class="test_jquery_trigger" onclick="$(this).trigger(\'test-click\');">Test Elem</p>' ), counterArray = [];
/**
* Resursively flattens an Array of depth n
*
* @param aSrc Array to be flattened
* @returns Array Single depth array
*/
var flatten = function(aSrc) {
if (Array.isArray(aSrc) && aSrc.length > 0) { // Test that paramater is both array and non-zero length
var head = aSrc[0], // Get first element from paramater
@ephbaum
ephbaum / PHP Countries Array
Created September 27, 2016 00:25 — forked from DHS/PHP Countries Array
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
@ephbaum
ephbaum / nationalities.php
Created September 27, 2016 00:25 — forked from zspine/nationalities.php
PHP Nationalities Array
$nationals = array(
'Afghan',
'Albanian',
'Algerian',
'American',
'Andorran',
'Angolan',
'Antiguans',
'Argentinean',
'Armenian',
@ephbaum
ephbaum / laravelsail.md
Created July 16, 2022 03:52
Laravel Sail - Install Existing Project

So you have you a little Laravel Repo and you want to use Sail. It was probably so easy to set up in the first place, but how in the hell are you planning to get this thing installed now?

You could use the composer/composer container to install composer dependencies, or you can use the laravelsail/php81-composer

docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/opt -w /opt laravelsail/php81-composer:latest composer install --ignore-platform-reqs

docker run --rm
-u "$(id -u):$(id -g)"
-v $(pwd):/opt
-w /opt \

@ephbaum
ephbaum / Animals.txt
Created April 17, 2023 05:03
A large list of animals
Aardvark
Abyssinian
Adelie Penguin
Affenpinscher
Afghan Hound
African Bush Elephant
African Civet
African Clawed Frog
African Forest Elephant
African Palm Civet
@ephbaum
ephbaum / find-duplicate-lines-and-delete-vim.md
Last active June 23, 2023 05:32
A vim command that will take a list in a buffer and find & remove 1 (or more) duplicate lines (instead of using `:sort u`
:g/^\(.*\)\n\1$/d
  • :g: The global (g) command in Vim, performs a certain action on lines that match a given pattern.
  • /^: This symbol denotes the start of a line.
  • \( and \): These parentheses are used for grouping in regex. Everything between \( and \) is treated as a single group. This group can be referenced later.
  • .*: The dot (.) stands for any character except a newline. The asterisk (*) is a quantifier, meaning "zero or more of the preceding element". So, .* matches any string, including an empty string.
  • \n: This represents a newline character.
  • \1: This is a backreference to the first (and only) group that we defined earlier. In this case, it refers to the exact string that was matched inside the \( and \).
  • $: This symbol denotes the end of a line.
@ephbaum
ephbaum / GerundVerbs.txt
Created April 17, 2023 05:34
A list of gerund verbs (verbs that end in -ing and function as nouns in a sentence, typically representing actions or processes)
abiding
acceding
accelerating
accepting
accomplishing
achieving
acquiring
activating
adapting
adding
@ephbaum
ephbaum / README.md
Created June 1, 2023 04:37
EPUB to TXT via NodeJS
@ephbaum
ephbaum / create-daily-markdown-file.sh
Last active September 1, 2023 15:44
Create Daily Note File
DaySuffix() {
case $(date +%d) in
01|21|31) echo "st";;
02|22) echo "nd";;
03|23) echo "rd";;
*) echo "th";;
esac
}
alias dailyfile="echo \"# $(date '+%A, %B %-d')$(DaySuffix), $(date '+%Y')\n\" > $(date '+%Y-%m-%d')-daily.md"