Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Desmond stevedesmond-ca

View GitHub Profile
View linux-setup.sh
#!/bin/bash
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
sudo bash -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
wget -q https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
@stevedesmond-ca
stevedesmond-ca / elevator.js
Created Apr 6, 2020
IWP Elevator Saga Mob Programming
View elevator.js
{
init: (elevators, floors) => {
const up_queue = [];
const down_queue = [];
const getIdleElevator = () => {
elevators.forEach((elevator) => {
if(elevator.destinationQueue.length == 0)
return elevator;
});
@stevedesmond-ca
stevedesmond-ca / complex.html
Last active Oct 27, 2015
responsive image complex example
View complex.html
<img src="IMG_4880-1280.jpg"
srcset="IMG_4880-0240.jpg 240w,
IMG_4880-0320.jpg 320w,
IMG_4880-0480.jpg 480w,
IMG_4880-0640.jpg 640w,
IMG_4880-0800.jpg 800w,
IMG_4880-0960.jpg 960w,
IMG_4880-1280.jpg 1280w,
IMG_4880-1600.jpg 1600w,
IMG_4880-1920.jpg 1920w,
@stevedesmond-ca
stevedesmond-ca / index.html
Created Oct 27, 2015
responsive image example
View index.html
<img src="steve-0300.jpg"
srcset="steve-0100.jpg 100w,
steve-0150.jpg 150w,
steve-0200.jpg 200w,
steve-0300.jpg 300w"
sizes="(max-width: 767px) 100px, 150px" />
@stevedesmond-ca
stevedesmond-ca / 1 ImageController.cs
Last active Oct 27, 2015
server-side responsive images
View 1 ImageController.cs
public FilePathResult Image(int id, int x, int y)
{
var image = db.Images.First(i => i.ID == id);
var newPath = image.GetFile(imagePath, new Size(x, y));
return File(newPath, "image/jpeg");
}
@stevedesmond-ca
stevedesmond-ca / photo.js
Created Oct 27, 2015
server-side responsive images (client-side)
View photo.js
var x = screen.width * window.devicePixelRatio;
var y = screen.height * window.devicePixelRatio;
var url = '/image?id=' + id + '&x=' + x + '&y=' + y;
$('.lightbox').css('background-image', 'url("' + url + '")');
You can’t perform that action at this time.