Skip to content

Instantly share code, notes, and snippets.

🔥

Emilio Cobos Álvarez emilio

🔥
Block or report user

Report or block emilio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@emilio
emilio / switch.html
Created Jun 11, 2019
Switch-styled checkbox.
View switch.html
<!doctype html>
<style>
.switch {
-moz-appearance: none;
-webkit-appearance: none;
display: inline-block;
position: relative;
background: #ccc;
border-radius: 1em;
height: 1em;
@emilio
emilio / reduce-css.js
Last active Mar 22, 2019
Ever wanted to reduce all the CSS in a test-case to the minimmum? :)
View reduce-css.js
var USELESS_PROPERTIES = [];
function processContainer(container) {
if (container instanceof CSSSupportsRule)
if (!CSS.supports(container.conditionText))
return false;
if (container instanceof CSSMediaRule)
if (!matchMedia(container.conditionText).matches)
return false;
if (container.media && container.media.mediaText)
View layout-ng.md
View extra-bounds.diff
diff --git a/servo/components/style_derive/to_css.rs b/servo/components/style_derive/to_css.rs
index a5811471cb1d..edb63b7c1ae8 100644
--- a/servo/components/style_derive/to_css.rs
+++ b/servo/components/style_derive/to_css.rs
@@ -5,24 +5,30 @@
use cg;
use darling::util::Override;
use quote::{ToTokens, Tokens};
use syn::{self, Data, Path, WhereClause};
use synstructure::{BindingInfo, Structure, VariantInfo};
@emilio
emilio / frame.html
Created Oct 16, 2018
Move a frame without reloading it.
View frame.html
<!doctype html>
<div id="host" style="overflow: hidden">
<iframe slot="first" src="https://example.com" id="theframe"></iframe>
</div>
<button onclick="theframe.setAttribute('slot', theframe.getAttribute('slot') == 'first' ? 'second' : 'first')">
Click to move the frame around, hopefully without reloading.
</button>
<script>
host.attachShadow({ mode: "open" }).innerHTML = `
<style>
View sync-load-shadow.diff
diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp
index 021b9b6320d8..8ebe471cab21 100644
--- a/dom/base/nsStyleLinkElement.cpp
+++ b/dom/base/nsStyleLinkElement.cpp
@@ -398,16 +398,27 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
thisContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::integrity,
integrity);
if (!integrity.IsEmpty()) {
MOZ_LOG(SRILogHelper::GetSriLog(), mozilla::LogLevel::Debug,
("nsStyleLinkElement::DoUpdateStyleSheet, integrity=%s",
View test-no-pgo.test0.rcgu.ll
; ModuleID = 'test-no-pgo.test0.rcgu.bc'
source_filename = "test0-317d481089b8c8fe83113de504472633.rs"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%"std::env::ArgsOs" = type { [0 x i64], %"std::sys::unix::args::Args", [0 x i64] }
%"std::sys::unix::args::Args" = type { [0 x i8], %"core::marker::PhantomData<*mut ()>", [0 x i8], %"alloc::vec::IntoIter<std::ffi::os_str::OsString>", [0 x i64] }
%"core::marker::PhantomData<*mut ()>" = type {}
%"alloc::vec::IntoIter<std::ffi::os_str::OsString>" = type { [0 x i8], %"core::marker::PhantomData<std::ffi::os_str::OsString>", [0 x i8], i64*, [0 x i64], i64, [0 x i64], %"std::ffi::os_str::OsString"*, [0 x i64], %"std::ffi::os_str::OsString"*, [0 x i64] }
%"core::marker::PhantomData<std::ffi::os_str::OsString>" = type {}
@emilio
emilio / notification.js
Last active Aug 8, 2019
window.Notification polyfill
View notification.js
/*
* window.Notification polyfill
* @author Emilio Cobos (http://emiliocobos.net)
*/
/* try prefixed */
if( ! window.Notification ) {
window.Notification = (function() {
return window.Notification || window.webkitNotification || window.mozNotification || window.oNotification || window.msNotification;
})()
You can’t perform that action at this time.