Skip to content

Instantly share code, notes, and snippets.

View mauricionobrega's full-sized avatar
:shipit:
Focusing

Mauricio Nobrega mauricionobrega

:shipit:
Focusing
View GitHub Profile
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
//browser-update.org notification script, <browser-update.org>
//Copyright (c) 2007-2009, MIT Style License <browser-update.org/LICENSE.txt>
var $buo = function(op,test) {
var jsv=5;
var n = window.navigator,b;
this.op=op||{};
//options
this.op.l = op.l||n["language"]||n["userLanguage"]||document.documentElement.getAttribute("lang")||"en";
this.op.vsakt = {i:9,f:13,o:12,s:5.1,n:20};
this.op.vsdefault = {i:7,f:3.6,o:10.6,s:4,n:10};
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;

Browser and Version Regular Expression 2.0

(MSIE|(?!Gecko.+)Firefox|(?!AppleWebKit.+Chrome.+)Safari|(?!AppleWebKit.+)Chrome|AppleWebKit(?!.+Chrome|.+Safari)|Gecko(?!.+Firefox))(?: |\/)([\d\.apre]+)

This regular expression is capable of retrieving the browser and version for the following browsers;

  • Internet Explorer
  • Firefox (INCLUDING alpha and "pre" versions)
  • Other browsers reporting a "Gecko" version in their user agent
  • Chrome
  • Safari
  • Other browsers reporting an "AppleWebKit" version in their user agent
@mauricionobrega
mauricionobrega / app.js
Created August 31, 2016 13:32 — forked from codepunkt/app.js
ExpressJS: set/delete cookies
// Dependencies.
var express = require('express')
app = module.exports = express.createServer(),
del = function(req, res) { res.clearCookie('login_token'); res.redirect('/'); },
set = function(req, res) { res.cookie('login_token', +new Date(), { maxAge: 3600000, path: '/' }); res.redirect('/'); };
// Config
app.configure(function() {
app.use(express.bodyParser());
app.use(express.cookieParser());
@mauricionobrega
mauricionobrega / SassMeister-input.scss
Created November 16, 2016 11:51 — forked from mikestreety/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
$ieSprite: '.lt-ie9' !default;
$baseFontSize: 16px !default;
// Converts px to em
@function mq-px2em($px, $base-font-size: $baseFontSize) {
@mauricionobrega
mauricionobrega / 1. Example.scss
Created February 16, 2017 17:35 — forked from Integralist/1. Example.scss
Sass Mixin for CSS3 Animations
@include keyframe(fadeout) {
0% {
opacity: 1;
}
100% {
opacity: 0;
}
}
dust.scopes = {};
dust.helpers.addToScope = function(chunk, context, bodies, params) {
return chunk.capture(bodies.block, context, function(out, chunk) {
var parts = params.key.split("."),
scopeKey = parts[0],
key = parts[1],
scope = dust.scopes[scopeKey] || {};
scope[key] = out;