Skip to content

Instantly share code, notes, and snippets.

@pyronaur
pyronaur / userscript.js
Created Dec 10, 2020
UserScript to Automatically clear GitHub CI Notifications
View userscript.js
// ==UserScript==
// @name Clear CI Activity Notification
// @version 1.0.0
// @grant none
// @match https://github.com/notifications
// ==/UserScript==
const notifications = document.querySelectorAll('.notifications-list-item')
const ciNotifications = Array.from(notifications).filter( (el) => {
return el.querySelector('div > div > span').innerText === "ci activity"
@pyronaur
pyronaur / gist:5387539
Last active Oct 2, 2019
sanitize_html_class works just fine for a single class But sometimes le wild `<span class="blue hedgehog">` appears, which is when you need this function, to validate both blue and hedgehog, Because sanitize_html_class doesn't allow spaces (because it's meant for a single class)
View gist:5387539
<?php
if ( ! function_exists( "sanitize_html_classes" ) && function_exists( "sanitize_html_class" ) ) {
/**
* sanitize_html_class works just fine for a single class
* Some times le wild <span class="blue hedgehog"> appears, which is when you need this function,
* to validate both blue and hedgehog,
* Because sanitize_html_class doesn't allow spaces.
*
* @uses sanitize_html_class
@pyronaur
pyronaur / index.html
Created Oct 26, 2017
BrowserSync FireFox FOUC
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Test Case</title>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<div id="foobar">doobar</div>
</body>
View functions.php
<?php
function seventeen_child_video_condition() {
return (is_front_page() || ( function_exists('phort_is_portfolio') && phort_is_portfolio() ) );
}
// Modify the header arguments
// PHP 5.3+
add_filter('twentyseventeen_custom_header_args', function($args){
@pyronaur
pyronaur / download_floor.php
Last active May 15, 2017
Calculate downloads floor
View download_floor.php
<?php
function download_floor($downloads) {
$length = strlen( $downloads );
$divider = intval( '1' . str_repeat( '0', $length - 1 ) );
return floor( $downloads / $divider ) * $divider;
}
@pyronaur
pyronaur / import_order.styl
Last active Apr 19, 2017
z-index layers in stylus
View import_order.styl
/**
*
* You can read more about this gist here:
* http://justnorris.com/manage-css-z-index/
*
*/
@require "layers.styl"
@require "z_index_layer.styl"
@require "usage.styl"
@require "z_index_debug.styl"
@pyronaur
pyronaur / bug.styl
Last active Jan 5, 2017
Stylus Bug in phpStorm EAP 2017.1
View bug.styl
// This Works
.the-thing
color: blue
@media screen and (min-width: 768px)
color: red
// This is broken
$breakpoint = "screen and (min-width: 768px)"
.the-thing
@pyronaur
pyronaur / WordPress.xml
Created Mar 7, 2016 — forked from Rarst/WordPress.xml
WordPress Live Templates for PhpStorm
View WordPress.xml
<?xml version="1.0" encoding="UTF-8"?>
<templateSet group="WordPress">
<template name="aa" value="add_action( '$hook$', '$callback$' );&#10;$END$" description="add_action" toReformat="false" toShortenFQNames="true">
<variable name="hook" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="callback" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="false" />
<option name="HTML" value="false" />
<option name="XSL_TEXT" value="false" />
<option name="XML" value="false" />
@pyronaur
pyronaur / gist:2315065
Created Apr 5, 2012
Porting Twitter Bootstrap 2.0 to SASS and Compass
View gist:2315065
// So this is an alternative way to do the Twitter bootstrap.
// The thing is that - this really takes A LOT OF rewriting the twitter bootstrap code.
// This is still work in progress, but I'd like to know if someone might consider this useful later on :)
// p.s. At this point I'm __really__ enjoying the @if and @else statements for the first time :)
@mixin nav_pills($extend: false) {
@include clearfix;
> li { float:left;}
> li > a {
@include nav_flatten;
@pyronaur
pyronaur / gist:966e9f379b7bf81257c5
Last active Aug 29, 2015
Velocity.js CoffeeScript Love
View gist:966e9f379b7bf81257c5
var argumentIndex;
var syntacticSugar;
syntacticSugar = ( arguments[0].properties !== undefined );
/* Detect jQuery/Zepto elements. */
if (this.jquery || (window.Zepto && window.Zepto.zepto.isZ(this))) {
isWrapped = true;
elements = this;