Skip to content

Instantly share code, notes, and snippets.

View giuseppeg's full-sized avatar
🌊
All is well.

Giuseppe giuseppeg

🌊
All is well.
View GitHub Profile
@giuseppeg
giuseppeg / dabblet.css
Created February 23, 2013 19:32
SitePoint Code Challenge: CSS – Drop Down Menus
/**
* SitePoint Code Challenge: CSS – Drop Down Menus
*/
/* Layout */
.menu,
.menu ul { padding: 0; list-style-type: none; }
.menu > li {
@giuseppeg
giuseppeg / dabblet.css
Created March 17, 2013 10:41 — forked from oksushi/dabblet.css
Making an ugly range slider (webkit only)
/**
* Making an ugly range slider (webkit only)
*/
input[type="range"] {
width: 100%;
height: 1em;
border-radius: 0.25em;
background-color: rgba(0, 0, 0, 0.05);
@giuseppeg
giuseppeg / dabblet.css
Created March 26, 2013 08:17
Vertical alignment
/**
* Vertical alignment
* Inspired by https://coderwall.com/p/oo2bqg
*/
html,
body { height: 100%; }
div:before {
content: " ";
@giuseppeg
giuseppeg / gist:5403569
Last active December 16, 2015 08:09
Simple Search Component - Fiddling a bit with Flight. converts /search/?q=foo to /search/foo Take in mind that this is my first Flight component.
'use strict';
define(
[
'component'
],
function (defineComponent) {
@giuseppeg
giuseppeg / mention.mrc
Created May 29, 2013 07:48
With this tiny script for mIRC you get a notification whenever someone mention you in a channel which is not the active one.
on ^*:text:*:#:{
if (($me isin $strip($1-)) && ($chan != $active)) {
echo -a -
echo -a $nick is talking about you on $chan ( $+ $1- $+ )
echo -a -
}
}
@giuseppeg
giuseppeg / _pxtorem.scss
Created July 3, 2013 16:46
SCSS function to convert pixels into rems. Supports multiple values (usefull for shorthand properties). Set $base-remContext to your body font-size;
@function pxtorem($values) {
$base-remContext: 16px !default;
$rem-values: ();
@each $value in $values {
@if $value == 0 or $value == 0px {
$rem-values: join($rem-values, 0);
} @else if type-of($value) == number and not unitless($value) and (unit($value) == px) {
$new-rem-value: $value / $base-remContext;
$rem-values: join($rem-values, #{$new-rem-value}rem);
@giuseppeg
giuseppeg / fuzzbuzz.js
Last active July 6, 2022 08:55
FizzBuzz solution with just one comparison:Bitwise operations, using predefined 0-15 numbers masksource: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
// FizzBuzz solution with one comparison:
// Bitwise operations, using predefined 0-15 numbers mask
// live demo: http://jsfiddle.net/TbAuQ/
// source: http://www.zoharbabin.com/which-fizzbuzz-solution-is-the-most-efficient
var words = [undefined, "Fizz", "Buzz", "FizzBuzz"],
mask = 810092048, //11 00 00 01 00 10 01 00 00 01 10 00 01 00 00
c = 0;
@giuseppeg
giuseppeg / gist:6041822
Created July 19, 2013 19:38
Chrome Office Hours: Performance. An mazing performance optimization live session with @paul_irish and @aerotwist
@giuseppeg
giuseppeg / module_definition.js
Created July 22, 2013 09:04
Simple module definition
(function (window, name, fn) {
if (typeof module === "object" && module && typeof module.exports === "object") {
module.exports = fn;
} else {
window[name] = fn;
if (typeof define === "function" && define.amd) {
define(name, [], function () {
return fn;
});
@giuseppeg
giuseppeg / flight-delegate.js
Created September 18, 2013 17:47
Twitter Flight's delegate fix - first draft. See https://github.com/flightjs/flight/issues/178
this.on = function() {
var $element, type, callback, originalCb, delegateRules;
var lastIndex = arguments.length - 1, origin = arguments[lastIndex];
if (lastIndex == 2) {
$element = $(arguments[0]);
type = arguments[1];
} else {
$element = this.$node;
type = arguments[0];