Skip to content

Instantly share code, notes, and snippets.

View emilio's full-sized avatar
🔥
🦊

Emilio Cobos Álvarez emilio

🔥
🦊
View GitHub Profile
@emilio
emilio / .vimrc
Created June 21, 2022 12:24
VimRC as of 2022-06-21
View .vimrc
call plug#begin()
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'udalov/kotlin-vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'preservim/nerdtree'
Plug 'rust-lang/rust.vim'
Plug 'vim-syntastic/syntastic'
Plug 'leafgarland/typescript-vim'
View buildwith
#!/usr/bin/bash
set -o errexit
# set -x
if [ $# -eq 0 ]; then
echo "Usage: buildwith modifier-1 ..."
exit 1
fi
@emilio
emilio / switch.html
Created June 11, 2019 10:56
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 March 22, 2019 10:48
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 October 16, 2018 23:13
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 September 24, 2020 07:44
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;
})()