Skip to content

Instantly share code, notes, and snippets.

View Shilo's full-sized avatar

Shilo Shilo

View GitHub Profile
@Shilo
Shilo / index.html
Last active June 21, 2023 14:22 — forked from chrisvfritz/index.html
Simplest possible HTML template
<!doctype html>
<html>
<head>
<title>This is the title of the webpage!</title>
</head>
<body>
<p>
This is an example paragraph.<br />
Anything in the <strong>body</strong> tag will appear on the page.<br />
Just like this <strong>p</strong> tag and its contents.
@Shilo
Shilo / Search my gists.md
Created June 25, 2022 00:57 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@Shilo
Shilo / Gists.md
Created June 25, 2022 00:57 — forked from BoQsc/Gists.md
How to search my own Gists
@Shilo
Shilo / Clamp.swift
Created June 8, 2022 15:08 — forked from leemorgan/Clamp.swift
clamp() in Swift
///Returns the input value clamped to the lower and upper limits.
func clamp<T: Comparable>(value: T, lower: T, upper: T) -> T {
return min(max(value, lower), upper)
}
//-----------------------------------------------
// Example usage
let proposedIndex = 6
@Shilo
Shilo / mac-keycodes
Created May 27, 2022 12:09 — forked from eegrok/mac-keycodes
Mac virtual keycodes
from: http://www.meandmark.com/keycodes.html
Virtual Keycodes for the Mac QWERTY Layout
Keycodes are in hexadecimal. A blank entry means either there is no key assigned to that keycode or I was unable to find the assigned key.
Keycode Key
0x00 A
0x01 S
0x02 D
0x03 F
public boolean isColorDark(int color){
double darkness = 1-(0.299*Color.red(color) + 0.587*Color.green(color) + 0.114*Color.blue(color))/255;
if(darkness<0.5){
return false; // It's a light color
}else{
return true; // It's a dark color
}
}
@Shilo
Shilo / cross-browser-opacity.css
Created December 23, 2019 09:21 — forked from arnoldc/cross-browser-opacity.css
css: cross browser opacity
selector {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
-moz-opacity: 0.3;
-khtml-opacity: 0.3;
opacity: 0.3;
}
@Shilo
Shilo / preserve-pixelation.scss
Created December 23, 2019 09:13 — forked from tombennet/preserve-pixelation.scss
Preserve pixelation when scaling pixel art with CSS - https://builtvisible.com/image-scaling-in-css/
@mixin pixelated {
-ms-interpolation-mode: nearest-neighbor; // IE 7+ (non-standard property)
image-rendering: -webkit-optimize-contrast; // Safari 6, UC Browser 9.9
image-rendering: -webkit-crisp-edges; // Safari 7+
image-rendering: -moz-crisp-edges; // Firefox 3.6+
image-rendering: -o-crisp-edges; // Opera 12
image-rendering: pixelated; // Chrome 41+ and Opera 26+
}
@Shilo
Shilo / angle-between-points.js
Created September 4, 2018 06:57 — forked from conorbuck/angle-between-points.js
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};
@Shilo
Shilo / gist:b3f581ef937dfc22466ca579176492d2
Created January 4, 2018 05:42 — forked from ozh/gist:4131243
Create dot files/directories (ie .file) on Windows

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.