Skip to content

Instantly share code, notes, and snippets.

View darrentorpey's full-sized avatar
❄️
one day at a time

Darren Torpey darrentorpey

❄️
one day at a time
  • Massachusetts, USA
View GitHub Profile
@darrentorpey
darrentorpey / upgrade-ruetech-dev-env-to-mysql-8.md
Last active August 18, 2022 22:22
Upgrade ruetech dev env to MySQL 8
  1. To get started, start in the ruetech docker dev env directory (ruetech/dockerfiles/dev_environment).

  2. Connect to VPN

  3. Shut down any running dev env docker containers:

docker compose down
  1. Check out the most recent code from develop:

PDP API Callouts example

Callouts today

Here's what callouts field looks like today:

{
  "callouts": [
@darrentorpey
darrentorpey / code.mmd
Last active September 13, 2021 17:20
PDP HTML Caching
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darrentorpey
darrentorpey / selenium-debugging.py
Last active September 20, 2021 19:43
selenium_debugging.py
# To see the current URL:
print('Current URL: {}'.format(self.browser.current_url))
main = self.driver.find_elements(By.CSS_SELECTOR, '.main-content')[0]
main_children = self.driver.find_elements(By.CSS_SELECTOR, '.main-content > *')
print('main', main.get_attribute('outerHTML'))
print('len', len(main_children))
@darrentorpey
darrentorpey / promises-and-closures.js
Created July 28, 2021 19:08
Demonstrating JS closures and promises
const people = {
1: 'Darren',
2: 'Devin',
3: 'Sean',
};
function reportOnId(id) {
return new Promise((resolve, reject) => {
const name = people[id];
@darrentorpey
darrentorpey / README.md
Last active November 11, 2022 12:46
jscodeshift codemod for Emotion CSS code that converts `styled('p')` expression to `styled.p` expressions etc.
@darrentorpey
darrentorpey / comparison.js
Last active April 29, 2017 17:46
async vs. non comparison (ES2017)
function newDecodedSourceSync(audioData) {
return new Promise((resolve) => {
const audioCtx = new AudioContext();
audioCtx.decodeAudioData(audioData, buffer => {
const source = createBufferSource(audioCtx, buffer);
resolve([audioCtx, buffer, source]);
},
(e) => `Error with decoding audio data ${e.err}`
@darrentorpey
darrentorpey / what_when_how.md
Last active March 13, 2017 13:24
Git scenarios: problems and solutions

Scenario: changes on wrong branch

Oops, I started making changes on the wrong branch and git checkout CORRECT_BRANCH says I cannot simply switch over

Solution

git stash
git checkout CORRECT_BRANCH
git stash pop
@darrentorpey
darrentorpey / marketplace_brand-category-filters.sql
Last active August 4, 2016 17:08
Helpful Marketplace SQL queries
-- ==================================
-- Marketplace Brand-Category filters
-- ==================================
SELECT
CASE WHEN brand.name IS NOT NULL THEN brand.name ELSE '[All]' END AS 'Brand',
CASE WHEN class.name IS NOT NULL THEN CONCAT_WS(' > ', division.name, department.name, class.name, subclass.name) ELSE '[All]' END AS 'Product Type',
channel.name AS 'Channel'
FROM marketplace_brandcategoryfilter as filter
LEFT OUTER JOIN brands_brand as brand
ON (brand.id = filter.brand_id)
@darrentorpey
darrentorpey / components.js
Created January 20, 2014 01:34
Updated code to adapt the original code from my Crafty tutorial (http://buildnewgames.com/introduction-to-crafty/) to work with Crafty 0.6.1
// The Grid component allows an element to be located
// on a grid of tiles
Crafty.c('Grid', {
init: function() {
this.attr({
w: Game.map_grid.tile.width,
h: Game.map_grid.tile.height
});
},