Skip to content

Instantly share code, notes, and snippets.

@polerin
polerin / gist:6253451
Created August 16, 2013 20:56
Tweaks for wftda.tv live feed page
#videodetails {
width : 31%;
}
#video {
width : 68.5%;
}
#videopane {
height : 470px;
@polerin
polerin / gist:03247f74323daad1b8c6
Created November 11, 2014 14:28
Remove the YouTube floating header from a page. Useful if you want to watch some long running video in a smaller window.
// Create a new bookmark and paste this in.
// Any time you want to remove the header, select that bookmark while on the page.
javascript:document.getElementById('yt-masthead-container').remove();
@polerin
polerin / faker.js
Created October 23, 2015 20:52
Generate fake users for Parse.
"use strict";
/**
* This assumes emails.js is something like
* modules.export = ["email1@whdfafdasdf.no", "email2@whdasdfasdf.never",...];
*
*
* @param request
* @param status
*/
exports.generateFakeUserData = function (request, status) {
@polerin
polerin / roundmanager.cs
Last active February 15, 2018 21:22
First time StartRound() is called, everything flows through correctly, including waiting the correct amount of time. Second time, it flows through to the await, but that never returns from the await.
namespace Blah {
public class RoundManager {
// ... //
/// <summary>
/// Load up the right round inspector and , activate the appropriate bins and dispensers.
/// </summary>
protected async void StartRound(RoundStartEvent StartEvent)
{
@polerin
polerin / Pattern.js
Last active March 5, 2018 23:51
Pseudo-enum "allowed values" pattern for Javascript
/**
* New pattern, pseudo-enum.
* Benefits:
* - no magic strings!
* - possible IDE completion
* - easier to track down what values are allowable (explicit list location)
* - better self documenting (container naming describes the intent of the field)
* - easy to inspect the object and see valid states in dev tools
* - possibly better on memory? Need to check references
@polerin
polerin / cleeng_resize.js
Last active May 4, 2018 23:39
Cleeng player resize
// Copy the below and use it to create a bookmarklet, or paste it into the developer console for the page.
// This should be used after the video is playing.
(function() {
var playerFrame = document.getElementsByTagName("iframe")[0];
console.log("changing size of iframe:", playerFrame);
playerFrame.style.width = "100%";
playerFrame.style.height = "100%";
console.log("changing max width of container");
@polerin
polerin / rant.txt
Created August 9, 2018 17:50
Soapbox -- Immutability and predictable systems
polerin [12:08 PM]
Well, lets discuss something. I'm not saying I'm right y'all. Just that I have... opinions.
heh
OK, so the general subject is this: Immutability/static behavior in OOP
As I mentioned in #ideabin, I find it frustrating when objects change state through method calls that don't seem like they should do that.
it introduces a lot of variability and potential for unexpected behavior.
polerin [12:10 PM]
So I feel like there are two general categories of classes/objects in what I'd consider a well structured OO environment.
Data containment/manipulation objects, and command/functional objects.
@polerin
polerin / Form.cs
Created January 21, 2020 16:52
Example UI Elements form structure -- simple "start game" menu
using System;
using System.Collections.Generic;
using UnityEngine;
using Unity.UIElements.Runtime;
using UnityEngine.UIElements;
using Zenject;
using SMG.Common.Exceptions;
/// <summary>
@polerin
polerin / AbstractContest.cs
Created January 30, 2020 18:59
lolAbstract
using System.Collections.Generic;
using Zenject;
using SMG.EventBus.Interfaces;
using SMG.Proximity.Players;
namespace SMG.Proximity.GameFlow
{
@polerin
polerin / DynamicMethodExample.php
Created April 6, 2022 16:17
Dynamic method example
<?php
interface IThingy
{
function getClassifier() : string;
}
class DynamicMethodHost
{
private string $methodPrefix = "__handle";