Skip to content

Instantly share code, notes, and snippets.

View fdrobidoux's full-sized avatar
📚
Working on a ReactJS certification!

Félix Dion-Robidoux fdrobidoux

📚
Working on a ReactJS certification!
View GitHub Profile
<?php
/*
* Add this code to your theme's functions.php file
*/
// Theme activation
add_action("after_switch_theme", "theme_activated");
function theme_activation_hook(){
error_log('theme activated');
}
@fdrobidoux
fdrobidoux / function-properties-scope-tests.js
Created July 28, 2016 21:23
Some tests I've done involving `this` scopes and `function` object properties.
function Foo() {
this.bar = "foo";
}
Foo.prototype.use = (function (_instance, _name) {
return Object.assign(function use() {
// console.log("false: ", _fn.hello);
// console.log("false: ", _fn.aBar);
console.log("true: ", _instance.bar);
console.log("true: ", this.use.hello);
@fdrobidoux
fdrobidoux / easy-dark-mode.css
Last active November 21, 2019 19:13
Easiest way to turn any web page into an alternative, dark-themed design. Based on Zeal's dark mode CSS file.
/* Based on https://github.com/zealdocs/zeal/blob/master/src/app/resources/browser/assets/css/darkmode.css */
html {
-webkit-filter: invert() hue-rotate(180deg) contrast(70%);
filter: invert() hue-rotate(180deg) contrast(70%);
background: #333;
}
html img {
-webkit-filter: invert() hue-rotate(180deg) contrast(120%);
filter: invert() hue-rotate(180deg) contrast(120%);
@fdrobidoux
fdrobidoux / gist:d0a9870d8aa790b6c1f56fe3d6837667
Created April 13, 2018 17:21
Fallout 4 - Scripts for follower management
cqf FollowersExtension "EFF:CompanionManager.SetCompanion" RefID False False
--------------------------
FORCE DISMISS:
--------------------------
setconsolescopequest followers
emptyrefalias companion
setplayerteammate 0
--------------------------
@fdrobidoux
fdrobidoux / RectangleExtensions.cs
Created June 3, 2019 18:37
Dumb rectangle extension I wasted time on.
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Text;
namespace MonoTycoon.Core.Physics
{
public static class RectangleExtensions
{
private const string BASE_FORMAT_STR = "{0} {{ {1} }}";
@fdrobidoux
fdrobidoux / MonoGame-scale-by-resolution.md
Created June 5, 2019 21:28
[MonoGame] Scale by resolution
private const float RESOLUTION_W = 1280;
private const float RESOLUTION_H = 720;
float scaleW = graphics.GraphicsDevice.Viewport.TitleSafeArea.Width / RESOLUTION_W;
float scaleH = graphics.GraphicsDevice.Viewport.TitleSafeArea.Height / RESOLUTION_H;
scale = new Vector2(scaleW, scaleH);
@fdrobidoux
fdrobidoux / iscast.cs
Created August 29, 2019 18:06
`Is` Casting in C#
/**
* Example with `is` that creates a casted item.
*/
public void onSomethingHappens(object sender, EventArgs args)
{
if (sender is XmlDocument xmlDoc)
{
}
@fdrobidoux
fdrobidoux / pubsub.js
Last active August 29, 2019 18:15 — forked from jyotiarora2610/Pub sub pattern
Simple publish/subscribe pattern in javascript.
let subscribers = {};
module.exports = {
publish(event, data) {
if (!subscribers[event]) return;
subscribers.forEach(callback => {
callback(data);
})
},
@fdrobidoux
fdrobidoux / noise-func-experiments.py
Last active September 5, 2019 18:02
Experimentation with noise functions
import random
import math
mapsize = 35
def print_chart(i, noise):
outstr = ''
for i in noise:
if (i > 0.75):
### Keybase proof
I hereby claim:
* I am fdrobidoux on github.
* I am fdrobidoux (https://keybase.io/fdrobidoux) on keybase.
* I have a public key ASDgtN1PTn7ej_PDxCxM_2TTfzZInd21xJM923CGO-_yRQo
To claim this, I am signing this object: