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
/** | |
* A function to convert letters into a phone number sequence. | |
* @param {string} searchStr - String of letters to convert into a phone number sequence. | |
* @returns {number} The String of letters converted into phone number sequence. | |
*/ | |
function lettersToPhoneNumber(searchStr) { | |
// convert lowercase string to uppercase since we compare against uppercase; | |
// then split string into an array of letters; | |
searchStr = searchStr.toUpperCase().split('') |
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
import AWS from 'aws-sdk' | |
import Buffer from 'buffer' | |
AWS.config.setPromisesDependency(require('bluebird')) | |
;(async () => { | |
const spaces = new AWS.S3({ | |
// {region}.digitaloceanspaces.com ex: nyc3.digitaloceanspaces.com |
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
dir | rename-item -NewName {$_.name -replace " ","_"} |
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
/** | |
* fillBlanks takes an array with falsy/null values, and fills them with the previous value in the array. | |
* If null values appear without a previous value, you can use nullReplace to autofill it. | |
* @example | |
* const arr = ["", "", 0, "", "", 1, "", 2, "", "", "", "Test", ""] | |
* fillBlanks(arr) | |
* // => [ null, null, 0, 0, 0, 1, 1, 2, 2, 2, 2, 'Test', 'Test' ] | |
* @example | |
* const arr = ["", "", 0, "", "", 1, "", 2, "", "", "", "Test", ""] | |
* fillBlanks(arr, "replaced") |
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
echo off | |
:: Handle CLI Args | |
IF [%1]==[] ( | |
echo No wallpaper path provided, please provide a full qualified path. Ex: C:\dir1\dir2\wallpaper.jpg | |
exit /b 1 | |
) | |
:: Commands | |
echo Changing wallpaper to: %1 |
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
update "listingSubscriptions" | |
set criteria = (jsonb_set(criteria::jsonb, '{moveInDateParsed}', '["",""]')); | |
update "listingSubscriptions" | |
set "criteria" = (criteria::jsonb - 'moveInDate')::json; | |
update "listingSubscriptions" | |
set criteria = (jsonb_set(criteria::jsonb, '{listPrice}', to_jsonb('{0,6000}'::int[]))) | |
where (criteria->'listPrice')::jsonb = '["",""]'; |
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
insert into "uiEvents" | |
select | |
row_number() over (order by id) + (select coalesce(max(id),0) from "uiEvents") as "id", | |
id as "userId", | |
tmp."eventTypes" as "eventType", | |
"createdAt", | |
"updatedAt" | |
from | |
users, | |
(select unnest(ARRAY['ONBOARD_MODAL','ONBOARD_SEARCH_TOUR']) as "eventTypes") as tmp |
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
// paste in chrome console. | |
let answers = Array.prototype.slice | |
.call( | |
document.querySelectorAll( | |
"table > tbody > tr > td > table > tbody > tr > td:nth-child(2)[valign='top'] > div > span.correctAnswerFlag" | |
) | |
) | |
.reduce((acc, n) => { | |
const node = n.parentNode.children[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
/** | |
* Title: Simple React State Management with Context | |
* Description: | |
* This is a React State Management proof of concept which uses the React ^16 Context API. | |
* This POC is loosely based on redux, with the ommission of reducers to limit the amount of boilerplate required. | |
* | |
* --- | |
* Author: Elias Hussary <[email protected]> | |
* Created: 2018-06-07 | |
* Updated: 2018-06-07 |
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
WITH from_table AS ( | |
SELECT unnest(array[ | |
-- tables go here | |
-- start | |
'bookSessions', | |
'bookTimeslots', | |
'bookUnits', | |
'carts', | |
'errorLogs', |
OlderNewer