Skip to content

Instantly share code, notes, and snippets.

View tomhodgins's full-sized avatar
😍
Writing CSS

Tommy Hodgins tomhodgins

😍
Writing CSS
View GitHub Profile
@tomhodgins
tomhodgins / Component.js
Created January 4, 2017 15:35 — forked from bloodyowl/Component.js
Component library in less than 140 bytes
b=0;$=x=>(p,i="_"+b++,u=($[i]=q=>eval(i).innerHTML=x(p,$[q],u),z=>($[++b]=z,`$.${i}(${b})`)))=>`<c id=${i}>${x(p,[]._,u)}</c>`
@tomhodgins
tomhodgins / windowResizeHeight.js
Created December 13, 2016 15:53 — forked from JKirchartz/windowResizeHeight.js
If I have to write bad code to get the "right" design, so be it, but at least I can keep it D.R.Y. -- This snippet listens to window sizing commands, internally the sameHeight functions take a container class and a child's class, find the tallest child, then makes all that containers children the same height -- this is only for when CSS's `flexb…
$(window).resize(function(){
function sameHeight(container, child) {
$(container).each(function(){
var tallest = 0;
$(child, this).each(function(){
if($(this).height() > tallest) {
tallest = $(this).height();
}
});
$(child, this).height(tallest);
@tomhodgins
tomhodgins / readme.md
Created July 14, 2016 13:24 — forked from xem/readme.md
Maths & trigonometry cheat sheet for 2D games

Conventions

  • o = [xo = 0, yo = 0] is the origin
  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@tomhodgins
tomhodgins / notepad.html
Last active December 19, 2015 11:39 — forked from jdkanani/notepad.html
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/solarized_dark");e.getSession().setMode("ace/mode/html");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;