This file contains hidden or 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
const capitalize = (s) => { | |
if (typeof s !== 'string') return ''; | |
return s.charAt(0).toUpperCase() + s.toLowerCase().slice(1) | |
} |
This file contains hidden or 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 showMultilevelDropdownMenu(title, elementId, data, nameKey, valueKey, childrenKey) { | |
/* | |
This function can be used to create a multilevel dropdown menu. | |
It needs the following arguments: | |
- title: title of the main Dropdown Button | |
- elementId: Where the dropdown menu will be generated within. | |
- data: array of JS object, with the following attributes: | |
- nameKey: this attribute will be used as the displayed innerHTML/ text of the menu option | |
- valueKey: this attribute will be used as the "value" attribute of the menu option |
This file contains hidden or 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
/* | |
In JS the array.sort() function can take a COMPARE function as an argument argument. The purpose of this function is to define an alternative order. | |
This is useful in cases where we need to sort an array of JS objects, using a key attribute, such as "ordering". | |
Example: | |
function(a, b) { | |
return a - b |
This file contains hidden or 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
# Hello World |
This file contains hidden or 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
<div style="page-break-after: always; visibility: hidden"> \pagebreak </div> |
This file contains hidden or 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
-- Clear all temp tables in your space | |
undef current_schema; | |
begin | |
for cur_cleanup in ( | |
select object_name | |
,object_type | |
from user_objects | |
where object_type = 'TABLE' | |
and temporary = 'Y' |
This file contains hidden or 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
from datetime import datetime, timedelta | |
from dateutil.tz import tzlocal | |
def convert_from_utc(input, offset=0, outputstr=True, tz=False): | |
''' | |
This operation accepts three arguments: | |
1. str input: Input with format specified below |