Skip to content

Instantly share code, notes, and snippets.

View LouisStAmour's full-sized avatar

Louis St-Amour LouisStAmour

View GitHub Profile
@LouisStAmour
LouisStAmour / remove-emoji.js
Created May 1, 2021 18:05
Remove emojis from a webpage - just paste into console and hit enter
// Sources:
// https://stackoverflow.com/a/64084994
// https://stackoverflow.com/a/25578365
/* Author:Scott Weaver Date:May,2021 */
var emojiPattern = String.raw`(?:\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffc|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffd|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffe|\ud83e\uddd1\ud83c\udffb\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udfff|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffb|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffd|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffe|\ud83e\uddd1\ud83c\udffc\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udfff|\ud83e\uddd1\ud83c\udffd\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83e\uddd1\ud83c\udffb|\ud83e\uddd1\ud83c\udffd\u200d\u2764\uf
@LouisStAmour
LouisStAmour / target_practice_modified.pde
Last active October 18, 2016 05:06
For DATT 1100 - demonstration of "layering"
PGraphics target;
void setup() {
size(500, 400);
target = createGraphics(width, height);
target.beginDraw();
target.background(0);
target.stroke(255);
target.fill(255);
target.ellipse(250, 200, 250, 250);
@LouisStAmour
LouisStAmour / sketch_151111a.pde
Created October 18, 2016 04:41
"neat little something" in Processing for DATT 1100
void setup() {
size(480, 480, P2D);
noStroke();
}
long i = 0;
float x = random(width);
float y = random(height);
long duration = 10;
float prevX = width/2;
@LouisStAmour
LouisStAmour / split_mint_transactions_csv.rb
Last active April 3, 2016 23:06
Ruby script to convert Mint.com transactions.csv from all accounts to per-account CSVs importable to QuickBooks Online (Canada)
# Assumes the current directory has a file named "Mint Transactions.csv"
# downloaded from mint using CSV by hitting "Export" under the per-page settings on
# Mint's All Transactions screen.
#
# This is meant for QuickBooks Online, since the CSV format for Canadians, at least,
# doesn't support the 2-column approach used by Mint (first column positive amount,
# second column debit/credit indicator) and in QBO, transactions must be imported
# one CSV file per account, while it's easier to export all accounts in Mint.
# So this script does both conversion to a negative/positive amount and writes CSVs
# per account.
@LouisStAmour
LouisStAmour / main.c
Created March 10, 2010 08:31
Quick try at matching wave whitecaps with OpenCV
#include <stdio.h>
#include "highgui.h"
#include "cv.h"
// A quick proof-of-concept by Louis St-Amour to scan for the white bits of waves
// in specific video files. Rather slow; each frame takes about 7 seconds (!)
// on a Core 2 Duo Unibody MacBook Pro.
IplImage* doPyrDown(IplImage* in, int filter) {
// Best to make sure input image is divisible by two.
@LouisStAmour
LouisStAmour / plugin.js
Created February 28, 2010 23:56
Proof-of-concept alpha of jQuery-oembed integrated with CKeditor on paste or when space is pressed.
/*
Auto-Insertion plugin
Copyright (c) 2010 Louis St-Amour, but multi-licensed as GPL/LGPL/MPL
Embeds: http://code.google.com/p/jquery-oembed/ (MIT License)
Plugin for: http://ckeditor.com/license (GPL/LGPL/MPL: http://ckeditor.com/license)
*/
(function($) {
$.oembedForURL = function(resourceURL, options, callback) {
require 'rubygems' # A script to pull and parse just routedetails
require 'jdbc/sqlite3' # Written in jRuby with jdbc-sqlite3 and celerity installed
require 'celerity' # Trust me, you'd prefer http://toronto.ca/open to this
# I'm using this to test the open dataset given as of Oct 27
# Assuming the following structure for database ...
# # DROP TABLE ttcca_routedetails; DROP TABLE ttcca_scheduleitem; DROP TABLE ttcca_routestop; DROP TABLE ttcca_stopdetails;
#
# sql = <<SQL
@LouisStAmour
LouisStAmour / gist:116077
Created May 22, 2009 11:55
Enable Drag & Drop reordering by default in SilverStripe (2.3.2 or higher)
<?php
# For the truly lazy (like myself) -- By Louis St-Amour
#
# A quick script to enable drag & drop reordering by default.
#
# To install:
# 1. Name this file MyCMSDecorator.php in mysite/code
# 2. Requires DataObject::add_extension('LeftAndMain', 'MyCMSDecorator');
# in mysite/_config.php
class MyCMSDecorator extends LeftAndMainDecorator {