Skip to content

Instantly share code, notes, and snippets.

View SteveDesmond-ca's full-sized avatar
🤘

Steve Desmond SteveDesmond-ca

🤘
View GitHub Profile
@SteveDesmond-ca
SteveDesmond-ca / .profile
Last active November 13, 2022 19:28
git-all
ga() {
find * -name .git -type d \
| sed 's/\/\.git$//' \
| sort \
| xargs -I % bash -c \
" \
echo && \
echo % && \
git -C % $* \
"
@SteveDesmond-ca
SteveDesmond-ca / Program.cs
Created February 24, 2022 17:29
SpeedCrawl PoC
using System.Collections.Concurrent;
using System.IO.Abstractions;
using System.Text.RegularExpressions;
using AngleSharp.Dom;
using AngleSharp.Html.Parser;
namespace SpeedCrawl.App;
public static class Program
{
@SteveDesmond-ca
SteveDesmond-ca / elevator.js
Created April 6, 2020 23:41
IWP Elevator Saga Mob Programming
{
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 October 27, 2015 16:02
responsive image complex example
<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 October 27, 2015 15:19
responsive image example
<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 October 27, 2015 15:04
server-side responsive images
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 October 27, 2015 14:50
server-side responsive images (client-side)
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 + '")');