Skip to content

Instantly share code, notes, and snippets.

View mrakowski0's full-sized avatar
🏠
Working from home

Michał Rakowski mrakowski0

🏠
Working from home
  • B2B
  • Szczecin, Poland
View GitHub Profile

FWIW: I didn't produce the content present here. I've just copy-pasted it from somewhere over the Internet, but I cannot remember exactly the original source. I was also not able to find the author's name, so I cannot give him/her the proper credit.


Effective Engineer - Notes

What's an Effective Engineer?

/* modernizr-test.js
* Daniel Ott
* 3 March 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
*/
@mrakowski0
mrakowski0 / index.haml
Created June 21, 2013 09:32
Simple countdown timer with zero hour listener.
%body
%article
.countdown
%span Time left:
.days{"data-unit" => "day"}
.hours{"data-unit" => "hrs"}
.minutes{"data-unit" => "min"}
.seconds{"data-unit" => "sec"}
@mrakowski0
mrakowski0 / application_helper.rb
Last active December 18, 2015 07:38
Ruby helper for I18n meta tags support.
def t_meta(meta)
path = request.path_info.gsub(/^(.*)\//, "")
translation_path = "t.head.#{meta}.#{path} | t.head.#{meta}.#{params[:locale]}"
eval translation_path
end
@mrakowski0
mrakowski0 / core.scss
Created April 19, 2013 09:43
Mixin that accepts a property and at least one value, then returns it as rem with px fallback.
html {
font-size: 62.5%;
}
.element {
@include rem-fallback(padding, 50, 30);
@include rem-fallback(margin, 120, auto);
}
@mrakowski0
mrakowski0 / fallbacks.scss
Created April 18, 2013 10:50
Older IE support for background-size (no js)
.no-backgroundsize {
.logo.elavon { @include bg-size(partners/elavon, png); }
.logo.fitnesspoint { @include bg-size(partners/fitnesspoint, jpg); }
.logo.inote { @include bg-size(partners/inote, png); }
}
@mrakowski0
mrakowski0 / mixins.scss
Last active December 15, 2015 13:58
Nested media queries
@mixin respond-to($media, $direction: max) {
@if $media == mobile {
@media only screen and (max-width: 320px) { @content; }
}
@else if $media == tablet {
@media only screen and (min-width: 768px) { @content; }
}
@else if $media == desktop {
@media only screen and (min-width: 1024px) { @content; }
}
@mrakowski0
mrakowski0 / mixins.scss
Last active December 15, 2015 13:59
Browser specific css mixin
@mixin support($browser) {
@if $browser == mozilla {
@media only screen and (min--moz-device-pixel-ratio:0) { @content; }
}
@if $browser == webkit {
@media only screen and (min-webkit-device-pixel-ratio:0) { @content; }
}
}
@mrakowski0
mrakowski0 / animation.scss
Created March 29, 2013 13:38
CSS Animation mixin
@mixin animation ($name, $duration: 1s, $effect: linear, $delay: 0, $play-count: infinite, $direction: normal) {
-webkit-animation: $name $duration $effect $delay $play-count $direction;
-webkit-animation-fill-mode: forwards; /* this prevents the animation from restarting! */
-moz-animation: $name $duration $effect $delay $play-count $direction;
-moz-animation-fill-mode: forwards; /* this prevents the animation from restarting! */
-o-animation: $name $duration $effect $delay $play-count $direction;
-o-animation-fill-mode: forwards; /* this prevents the animation from restarting! */