Skip to content

Instantly share code, notes, and snippets.

View roden0's full-sized avatar
🎯
Focusing

Rodrigo Encinas roden0

🎯
Focusing
  • Barcelona
View GitHub Profile
@roden0
roden0 / key_event.js
Last active December 30, 2015 00:19
jquery on key Enter
$('').on('keypress', function (e) {
var code = (e.keyCode ? e.keyCode : e.which);
if (code == 13 &! foo) {
e.preventDefault();
//console.log("pressed");
}
});
@roden0
roden0 / arraySort.js
Last active December 21, 2015 19:20
Array Sort by timestamp
$(document).ready(function ubsrt()
{
myList = [];
myList[0] = {};
myList[0]['title'] = 'I am really new';
myList[0]['timestamp'] = 1317039046;
myList[0]['date'] = '2011-09-26T12:10:46+00:00';
myList[1] = {};
@roden0
roden0 / mixins.scss
Last active December 20, 2015 03:09
Sass mixins.
@mixin breakpoint($point) {
@if $point == large {
@media (min-width: 64.375em) { @content; }
}
@else if $point == medium {
@media (min-width: 50em) { @content; }
}
@else if $point == small {
@media (min-width: 37.5em) { @content; }
}
@roden0
roden0 / fonts.scss
Created July 23, 2013 10:24
Fonts Sass
$helvetica: "helvetica neue", arial, helvetica, freesans,
"liberation sans", "numbus sans l", sans-serif;
$geneva: geneva, tahoma, "dejavu sans condensed",
sans-serif;
$lucida: "lucida grande", "lucida sans unicode",
"lucida sans", lucida, sans-serif;
$verdana: verdana, "bitstream vera sans", "dejavu sans",
"liberation sans", geneva, sans-serif;
$cambria: cambria, georgia, "bitstream charter",
"century schoolbook l", "liberation serif", times,
@roden0
roden0 / reset.sass
Created July 23, 2013 09:37 — forked from trey/reset.sass
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain) */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
.sidebar {
width: percentage(360px / 960px);
}
//px to em
@function calc-em($target-px, $context) {
@return ($target-px / $context) * 1em;
}
//IE fluid images
function timeDifference(current, previous) {
var msPerMinute = 60 * 1000;
var msPerHour = msPerMinute * 60;
var msPerDay = msPerHour * 24;
var msPerMonth = msPerDay * 30;
var msPerYear = msPerDay * 365;
var elapsed = current - previous;
@roden0
roden0 / animation1.css
Created July 6, 2013 14:07
CSS. Animation
#foxtail {
background: url(foxtail.png) 0 0 no-repeat;
width: 156px;
height: 156px;
}
@keyframes animate-tail {
0% {background-position: -6864px 0; }
100% {background-position: 0 0;}
}
//$('#container');
var container = document.querySelector('#container');
//$('#container').find('li');
var lis = document.querySelectorAll('#container li');
//$('a').on('click', fn);
[].forEach.call( document.querySelectorAll('a'), function(el) {
el.addEventListener('click', function() {
// callback
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
/*
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
*/