Skip to content

Instantly share code, notes, and snippets.

@tiborsimon
tiborsimon / Player_calculateDistance.java
Created February 16, 2015 12:34
Java Shooter Game - Player:: calculateDistance(float base, float target) - http://tibor-simon.com/programming/auto-aiming-logic-for-games/
private float calculateDistance(float base, float target) {
double sinB = Math.sin((base)*Math.PI/180.0);
double cosB = Math.cos((base)*Math.PI/180.0);
double sinT = Math.sin((target)*Math.PI/180.0);
double cosT = Math.cos((target)*Math.PI/180.0);
double ret = Math.sqrt(Math.pow(Math.abs(sinB-sinT),2) + Math.pow(Math.abs(cosB-cosT),2));
return (float)ret;
}
/* Gravatar hovercard's class */
.gcard {
/* use big enough number */
z-index: 99999 !important;
}
//=============================================================================
//-----------------------------------------------------------------------------
// S L O T C A R P E R I O D F I N D E R A L G O R I T H M
//-----------------------------------------------------------------------------
//=============================================================================
//
// This SciNote demonstrates the operation of a very simple thus very specific
// period finder algorithm, that was developed for a autonome real-time slot
// car race.
//
@tiborsimon
tiborsimon / known_hosts_paths.txt
Created February 18, 2015 09:27
The files where git stores it's known hosts (win7)
c:\Users\USERNAME\.ssh\known_hosts
c:\Users\USERNAME\AppData\Local\VirtualStore\Program Files (x86)\Git\.sshknown_hosts
@tiborsimon
tiborsimon / regexp
Last active August 29, 2015 14:17
Regexp pattern for removing Social Locker shortcodes.
\[/?social[\w"=\d\s]*\]
This pattern will find both pair of tags of this shortcode:
[sociallocker id="123"][/sociallocker]
@tiborsimon
tiborsimon / gist:bb1a6a61f370bdf6d3ef
Last active August 29, 2015 14:19
Jekyll solarized code highlight box with pygment and kramdown
table.highlighttable {
border-collapse: separate;
border-spacing: 0;
@include rounded(6px);
@include box-shadow(0 2px 5px rgba(0, 0, 0, 0.09));
overflow: hidden;
margin-bottom: 25px;
border: 1px solid rgba(147, 161, 161, 0.55);
}
@tiborsimon
tiborsimon / gist:2479af323b7af1381a35
Last active August 29, 2015 14:19
Testing highlight
from itertools import count
def generate_primes(stop_at=0):
primes = []
for n in count(2):
if 0 < stop_at < n:
for p in primes:
if not n % p:
composite = True
@tiborsimon
tiborsimon / gist_variables_light.scss
Last active August 29, 2015 14:20
Solarized Gist CSS SASS variables
// Solarized light syntax highlight
// --------------------------------------------------
$gist-base03 : #002b36;
$gist-base02 : #073642;
$gist-base01 : #586e75;
$gist-base00 : #657b83;
$gist-base0 : #839496;
$gist-base1 : #93a1a1;
$gist-base2 : #eee8d5;
@tiborsimon
tiborsimon / solarized_gist.scss
Last active August 29, 2015 14:20
Solarized Gist CSS SASS main style sheet.
@mixin scrollbars($size, $foreground-color, $background-color: mix($foreground-color, white, 50%)) {
// For Google Chrome
::-webkit-scrollbar {
width: $size;
height: $size;
}
::-webkit-scrollbar-thumb {
background: $foreground-color;
@tiborsimon
tiborsimon / solarized_gist_light.css
Last active August 5, 2017 20:16
Solarized Gist theme using basic CSS.
.gist .gist-file {
background-color: transparent !important;
border: none !important;
background-color: #fdf6e3;
::-webkit-scrollbar {
width: .5em;
height: .5em;
}