Skip to content

Instantly share code, notes, and snippets.

Shilo Shilo

Block or report user

Report or block Shilo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Shilo
Shilo / aspect_fit_bounds_in_bounds.js
Last active Aug 21, 2018
Javascript snippet to aspect fit bounds in bounds.
View aspect_fit_bounds_in_bounds.js
aspectFitBoundsInBounds(src, dest, center=true) {
let WIDTH_KEY = "width";
let HEIGHT_KEY = "height";
let largerSide = src.height > src.width ? HEIGHT_KEY : WIDTH_KEY;
let smallerSide = largerSide == HEIGHT_KEY ? WIDTH_KEY : HEIGHT_KEY;
let aspectRatio = src[smallerSide]/src[largerSide];
src[largerSide] = dest[largerSide];
src[smallerSide] = dest[largerSide]*aspectRatio;
@Shilo
Shilo / jekyll_blog_quotes.md.html
Created Aug 17, 2018
Jekyll page that will list quotes in all the posts.
View jekyll_blog_quotes.md.html
---
layout: page
title: Recent Blog Quotes
menu_title: Quotes
menu: true
order: 4
---
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
@Shilo
Shilo / blogger_quotes.js
Last active Aug 17, 2018
Blogger page that will list quotes in all the posts.
View blogger_quotes.js
<script>
$(document).ready(function () {
var feed = "/feeds/posts/default?alt=rss";
$.ajax(feed, {
accepts: {
xml: "application/rss+xml"
},
dataType: "xml",
error: function (xhr, status, error) {
var contentsDiv = $("#contents");
@Shilo
Shilo / _list_folder_content_to_cmd.bat
Last active Jul 26, 2018
Command prompt batch files to list folder and file names of current folder.
View _list_folder_content_to_cmd.bat
@echo off
dir /a /b
pause
@Shilo
Shilo / youtube_big_theater_mode_injection.js
Last active Jul 13, 2018
YouTube.com "big theater mode" injection. Gives the video full height when in theater mode.
View youtube_big_theater_mode_injection.js
(function() {
var coverNavBar = true;
var css = `
ytd-watch:not([fullscreen])[theater] #player.ytd-watch {
height: ` + (coverNavBar?'':'calc(') + '100vh' + (coverNavBar?'':' - 56px)') + ` !important;
max-height: none !important;` + (coverNavBar?`
position: relative;
margin-top: -56px;
z-index: 9999;
@Shilo
Shilo / youtube_fullscreen_injection.js
Last active Jul 13, 2018
YouTube.com fullscreen injection to put the video in fullscreen. (Scrubber disabled due to issues with the fullscreen mode)
View youtube_fullscreen_injection.js
var sizeButton = document.getElementsByClassName("ytp-size-button")[0];
var sizeButtonTitle = sizeButton.getAttribute('title');
var shouldDefaultView = sizeButtonTitle != null && sizeButtonTitle.toLowerCase() == 'default view';
if (shouldDefaultView) {
sizeButton.click();
}
setTimeout(function() {
var playButton = document.getElementsByClassName("ytp-play-button")[0];
@Shilo
Shilo / quietube_fullscreen_injection.js
Created Jul 11, 2018
Quiettube7.com fullscreen injection to put the video in fullscreen.
View quietube_fullscreen_injection.js
(function() {
var css = `
html, body {
height: 100%;
}
body {
overflow: hidden;
}
@Shilo
Shilo / css_injection.js
Last active Jul 11, 2018
One Line Javascript CSS Injection.
View css_injection.js
(function() { var css = `body{background-color:black;}`; var cssDiv = document.createElement('div'); cssDiv.innerHTML = '&shy;<style>' + css + '</style>'; document.body.appendChild(cssDiv.childNodes[1]); })();
@Shilo
Shilo / JavaSetTimeout.java
Last active Jun 14, 2018
Java "setTimeout" equivalent. (Credit: Oleg Mikhailov, http://stackoverflow.com/a/36842856)
View JavaSetTimeout.java
// Asynchronous implementation with JDK 1.8:
public static void setTimeout(Runnable runnable, int delay){
new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
}
catch (Exception e){
System.err.println(e);
}
@Shilo
Shilo / NSString+Reverse.h
Last active Apr 24, 2018
A category for NSString to reverse string.
View NSString+Reverse.h
//
// NSString+Reverse.h
//
// Created by Shilo White on 9/1/13.
// Copyright (c) 2013 Shilocity Productions. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (Reverse)
You can’t perform that action at this time.