Index | 12 |First name | 13 |Last name | 14 |Country | 16 |Dob | 17 ||
---|---|---|---|---|---|
1 | Dreddy | Norgate | dnorgate0@java.com | Indonesia | 03/09/1956 |
2 | Rodger | Parkins | rparkins1@imdb.com | Brazil | 02/25/1881 |
3 | Udell | Treeby | utreeby2@xing.com | Bolivia | 01/25/1969 |
4 | Marsiella | Ghelarducci | mghelarducci3@cpanel.net | Japan | 10/16/1976 |
5 | Kerwinn | Dickey | kdickey4@cornell.edu | Thailand | 10/04/1982 |
6 | Rani | Meatyard | rmeatyard5@twitpic.com | China | 09/10/1898 |
7 | Bianka | Spellacy | bspellacy6@icq.com | United States | 08/28/1912 |
8 | Dianna | Jouaneton | djouaneton7@samsung.com | Montenegro | 12/04/1915 |
9 | Emlyn | Preator | epreator8@chicagotribune.com | Indonesia | 03/13/1954 |
10 | Kellie | Leipelt | kleipelt9@columbia.edu | China | 12/03/1976 |
11 | Trisha | Giorgioni | tgiorgionia@cloudflare.com | Bosnia and Herzegovina | 07/30/1961 |
12 | Lyn | Gault | lgaultb@google.es | Portugal | 03/20/1971 |
13 | Carolan | Redgrave | credgravec@twitpic.com | Argentina | 09/12/1931 |
14 | Adler | Fasset | afassetd@sohu.com | Albania | 05/15/1961 |
15 | Lucretia | Huxton | lhuxtone@pen.io | Colombia | 11/17/1896 |
Functions: | 17 |PHP | 18 |JavaScript | 19 |Python | 20 |
---|---|---|---|
String length | 27 |strlen($str) |
28 | str.length |
29 | len(str) |
30 |
Array size | 34 |count($array) |
35 | array.length |
36 | len(array) |
37 |
Creating a function | 41 |function print() |
42 | function print() |
43 | def function: |
44 |
id | 29 |first_name | 30 |last_name | 31 |date | 33 |amount | 34 |
---|
First name | Last name | Country | Dob | |
---|---|---|---|---|
Johny | Walker | johny.walker@whiskey.com | Scotland | 1/1/1920 |
nikhil | Vartak | nikhil.vartak@hotmail.co.in | india | 12/5/1986 |
Peter | James | james_peter@hotmail.com | germany | 5/10/1960 |
nikhil | Vartak | nikhil.vartak@hotmail.com | india | 11/27/1984 |
Peter | James | james_peter@hotmail.com | germany | 5/10/1960 |
jack | Daniel | j'daniels@whiskey.com | USA | 1/10/1846 |
nikhil | Vartak | nikhil.vartak@hotmail.co.in | india | 12/5/1986 |
Peter | James | james_peter@hotmail.com | germany | 5/10/1960 |
jack | Daniel | j'daniels@whiskey.com | USA | 1/10/1846 |
jack | Daniel | j'daniels@whiskey.com | USA | 1/10/1846 |
Mark | Anderson | anderson_m@gmail.com | canada | 2/29/1980 |
jack | Daniel | j'daniels@whiskey.com | USA | 1/10/1846 |
nikhil | Vartak | nikhil.vartak@hotmail.co.in | india | 12/5/1986 |
jack | Daniel | j'daniels@whiskey.com | USA | 1/10/1846 |
Peter | James | james_peter@hotmail.com | germany | 5/10/1960 |
This is going to be an ongoing project where that reviews some functions/code snippets and the different syntax between common programming languages.
10 | 11 | 12 |Functions: | 17 |PHP | 18 |JavaScript | 19 |Python | 20 |
---|---|---|---|
String length | 27 |strlen($str) |
28 | str.length |
29 | len(str) |
30 |
Array size | 34 |count($array) |
35 | array.length |
36 | len(array) |
37 |
Creating a function | 41 |function print() |
42 | function print() |
43 | def function: |
44 |
for ($x = 0; $x <= 100; $x+=10) {
51 | echo "The number is: $x";
52 | }
53 |
54 | for (i = 0; i < len; i++) {
56 | text += cars[i];
57 | }
58 |
59 | fruits = ["apple", "banana", "cherry"]
62 | for x in fruits:
63 | print(x)
64 |
65 | for x in "banana":
67 | print(x)
68 |
69 | for x in range(6):
71 | print(x)
72 |
73 |
--------------------------------------------------------------------------------
/entries/personal-python-functions.md:
--------------------------------------------------------------------------------
1 | # Personal Python Library
2 |
3 | This is my personal python utilities library that I made so that I can quickly access it from anywhere if needed. This is a work in progress so I will be updating as the time comes. The repo can be found [here](https://github.com/rrickgauer/python-utilities).
4 |
5 | ## Functions
6 | ### Space
7 | This function basically just prints out a specified number of new lines.
8 |
9 | ```python
10 | def space(numSpaces = 1):
11 | for x in range(numSpaces):
12 | print('')
13 | ```
14 |
15 | ### Beautiful Table
16 |
17 | [Beautiful Table](https://github.com/pri22296/beautifultable) is a module I just discovered the other day. It has come in quite handy, and I highly recommend to anyone that needs an easy way to print out tables in the terminal.
18 |
19 | #### Installation
20 |
21 | ```shell
22 | pip install beautifultable
23 | ```
24 |
25 | #### Usage
26 | ```python
27 | from beautifultable import BeautifulTable
28 |
29 | def getTable(data, columns=[]):
30 | table = BeautifulTable(max_width=1000)
31 | table.set_style(BeautifulTable.STYLE_COMPACT)
32 |
33 | if len(columns) > 0:
34 | table.column_headers=columns
35 |
36 | for row in data:
37 | table.append_row(row)
38 |
39 | table.column_alignments = BeautifulTable.ALIGN_LEFT
40 | return table
41 | ```
42 |
--------------------------------------------------------------------------------
/entries/php-bootstrap-alert-function.md:
--------------------------------------------------------------------------------
1 | Many times, I have had to create a [bootstrap alert](https://getbootstrap.com/docs/4.5/components/alerts/) in my web applications. So many in fact, I started writing a php function that can create it for me. Here is my snippet.
2 |
3 | This is the function you can use throughout your code:
4 |
5 | ```php
6 | // returns a bootstrap alert
7 | function getAlert($message, $alertType = 'success') {
8 | return "
9 | id | 20 |first_name | 21 |last_name | 22 |date | 24 |amount | 25 ||
---|---|---|---|---|---|
1 | 30 |Lionello | 31 |Cavanagh | 32 |lcavanagh0@theglobeandmail.com | 33 |1/29/2020 | 34 |176.18 | 35 |
2 | 38 |Emmi | 39 |Gill | 40 |egill1@yellowbook.com | 41 |4/23/2020 | 42 |192.69 | 43 |
3 | 46 |Heath | 47 |Surmeyer | 48 |hsurmeyer2@samsung.com | 49 |8/18/2019 | 50 |241.93 | 51 |
8 |
9 |
7 | © @DateTime.Now.Year by 8 | Ryan Rickgauer 9 |
-------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/Views/Includes/_Footer.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/Views/Includes/_Header.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |
12 | Request ID: @Model.RequestId
13 |
18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |
20 |21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |
26 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using Blog.Gui 2 | @using Blog.Gui.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/css/custom/style.scss: -------------------------------------------------------------------------------- 1 | body { 2 | /*background-color: whitesmoke !important;*/ 3 | margin-bottom: 50px; 4 | font-size: 1rem; 5 | } 6 | 7 | .entry { 8 | display: flex; 9 | justify-content: space-between; 10 | background-color: inherit; 11 | } 12 | 13 | .entry .title { 14 | font-weight: 700; 15 | } 16 | 17 | .entry .date { 18 | opacity: 0.8; 19 | } 20 | 21 | .custom-font { 22 | font-family: 'Special Elite', cursive; 23 | } 24 | 25 | 26 | 27 | h1.custom-font { 28 | font-size: 40px; 29 | text-align: center; 30 | border: none; 31 | margin: 0; 32 | padding: 0; 33 | } 34 | 35 | #hero { 36 | font-family: 'Special Elite', cursive; 37 | font-size: 64px; 38 | border: none; 39 | padding: 0; 40 | margin: 0; 41 | text-align: center; 42 | } 43 | 44 | table { 45 | table-layout: auto; 46 | width: 100% !important; 47 | } 48 | 49 | .toolbar-select { 50 | display: flex; 51 | align-items: center; 52 | justify-content: flex-start; 53 | margin-bottom: 20px; 54 | margin-left: 10px; 55 | 56 | .label { 57 | margin-right: 10px; 58 | } 59 | 60 | .select-sort { 61 | padding-right: 50px; 62 | } 63 | } 64 | 65 | @media screen and (max-width: 700px) { 66 | 67 | .toolbar-select { 68 | display: block; 69 | } 70 | 71 | 72 | h1 { 73 | font-size: 36px !important; 74 | } 75 | 76 | .entry { 77 | flex-direction: column; 78 | } 79 | 80 | .post-title { 81 | font-size: 30px !important; 82 | } 83 | 84 | .container, 85 | body { 86 | padding: 0; 87 | } 88 | 89 | body { 90 | margin: 8px; 91 | margin-top: 20px; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rrickgauer/blog/db2d609b59c22571d685ce83c436552a69ad80fc/src/gui/Blog/Blog.Gui/wwwroot/favicon.ico -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rrickgauer/blog/db2d609b59c22571d685ce83c436552a69ad80fc/src/gui/Blog/Blog.Gui/wwwroot/img/icon.png -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/js/custom/entry.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const fontClass = '.custom-font'; 4 | 5 | var typeit = new TypeIt(fontClass, { 6 | speed: 50, 7 | startDelay: 900 8 | }) 9 | .options({ 10 | speed: 50 11 | }); 12 | 13 | 14 | typeit.go(); -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/js/custom/home.js: -------------------------------------------------------------------------------- 1 | 2 | const SORT_OPTIONS = { 3 | DATE: "date", 4 | TITLE: "title", 5 | }; 6 | 7 | 8 | ////////// 9 | // main // 10 | ////////// 11 | $(document).ready(function() { 12 | addMyListeners(); 13 | initTypeIt(); 14 | }); 15 | 16 | 17 | function addMyListeners() { 18 | $('.select-sort').on('change', sortEntries); 19 | $('.select-filter').on('change', filterEntries); 20 | } 21 | 22 | function initTypeIt() { 23 | new TypeIt('.custom-font', { 24 | speed: 50, 25 | startDelay: 900 26 | }) 27 | .options({speed: 50}) 28 | .go(); 29 | } 30 | 31 | 32 | function sortEntries() { 33 | var sortOption = $('.select-sort').val(); 34 | 35 | if (sortOption == SORT_OPTIONS.DATE) 36 | sortEntriesByDate(); 37 | else 38 | sortEntriesByTitle(); 39 | } 40 | 41 | 42 | function sortEntriesByDate() { 43 | var entries = $('.entry'); 44 | 45 | entries.sort(function(a, b) { 46 | var dateA = $(a).attr('data-date'); 47 | var dateB = $(b).attr('data-date'); 48 | 49 | return (parseInt(dateA) > parseInt(dateB)) ? -1 : 1; 50 | }); 51 | 52 | $('.list-group').html(entries); 53 | } 54 | 55 | function sortEntriesByTitle() { 56 | var entries = $('.entry'); 57 | 58 | entries.sort(function(a, b) { 59 | var titleA = $(a).find('.title a').text().toUpperCase(); 60 | var titleB = $(b).find('.title a').text().toUpperCase(); 61 | 62 | return (titleA < titleB) ? -1 : 1; 63 | }); 64 | 65 | $('.list-group').html(entries); 66 | } 67 | 68 | function filterEntries() { 69 | const newFilterValue = $('.select-filter option:checked').val(); 70 | const entries = $('.entry'); 71 | 72 | if (newFilterValue == '_all') { 73 | $(entries).removeClass('d-none'); 74 | } else { 75 | $(entries).addClass('d-none'); 76 | $(`.entry[data-topic-id="${newFilterValue}"]`).removeClass('d-none'); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/lib/js/tablesort/tablesort.date.js: -------------------------------------------------------------------------------- 1 | // Basic dates in dd/mm/yy or dd-mm-yy format. 2 | // Years can be 4 digits. Days and Months can be 1 or 2 digits. 3 | (function(){ 4 | var parseDate = function(date) { 5 | date = date.replace(/\-/g, '/'); 6 | date = date.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2,4})/, '$3-$2-$1'); // format before getTime 7 | 8 | return new Date(date).getTime() || -1; 9 | }; 10 | 11 | Tablesort.extend('date', function(item) { 12 | return ( 13 | item.search(/(Mon|Tue|Wed|Thu|Fri|Sat|Sun)\.?\,?\s*/i) !== -1 || 14 | item.search(/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/) !== -1 || 15 | item.search(/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i) !== -1 16 | ) && !isNaN(parseDate(item)); 17 | }, function(a, b) { 18 | a = a.toLowerCase(); 19 | b = b.toLowerCase(); 20 | 21 | return parseDate(b) - parseDate(a); 22 | }); 23 | }()); 24 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/lib/js/tablesort/tablesort.dotstep.js: -------------------------------------------------------------------------------- 1 | // Dot separated values. E.g. IP addresses or version numbers. 2 | Tablesort.extend('dotsep', function(item) { 3 | return /^(\d+\.)+\d+$/.test(item); 4 | }, function(a, b) { 5 | a = a.split('.'); 6 | b = b.split('.'); 7 | 8 | for (var i = 0, len = a.length, ai, bi; i < len; i++) { 9 | ai = parseInt(a[i], 10); 10 | bi = parseInt(b[i], 10); 11 | 12 | if (ai === bi) continue; 13 | if (ai > bi) return -1; 14 | if (ai < bi) return 1; 15 | } 16 | 17 | return 0; 18 | }); 19 | -------------------------------------------------------------------------------- /src/gui/Blog/Blog.Gui/wwwroot/lib/js/tablesort/tablesort.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * tablesort v5.2.1 (2020-06-02) 3 | * http://tristen.ca/tablesort/demo/ 4 | * Copyright (c) 2020 ; Licensed MIT 5 | */ 6 | !function(){function a(b,c){if(!(this instanceof a))return new a(b,c);if(!b||"TABLE"!==b.tagName)throw new Error("Element must be a table");this.init(b,c||{})}var b=[],c=function(a){var b;return window.CustomEvent&&"function"==typeof window.CustomEvent?b=new CustomEvent(a):(b=document.createEvent("CustomEvent"),b.initCustomEvent(a,!1,!1,void 0)),b},d=function(a){return a.getAttribute("data-sort")||a.textContent||a.innerText||""},e=function(a,b){return a=a.trim().toLowerCase(),b=b.trim().toLowerCase(),a===b?0:a0)if(a.tHead&&a.tHead.rows.length>0){for(e=0;e