Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

roose roose

🏠
Working from home
Block or report user

Report or block roose

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
View emerge1.2.1.nice.js
//! v.1.2.1, http://ilyabirman.net/projects/emerge/
if (jQuery) {
!function($) {
$(function() {
/**
* @param {Element} obj
* @return {?}
*/
$.expr[":"].uncached = function(obj) {
if (!$(obj).is('img[src!=""]')) {
View emerge1.2.1.min.js
//! v.1.2.1, http://ilyabirman.net/projects/emerge/
jQuery&&(!function(t){t(function(){t.expr[":"].uncached=function(a){if(!t(a).is('img[src!=""]'))return!1;var e=new Image;return e.src=a.src,!e.complete};var a=[],e=500,i=!1,r=!1,o=["backgroundImage","borderImage","borderCornerImage","listStyleImage","cursor"],n=/url\(\s*(['"]?)(.*?)\1\s*\)/g,s=0,d=function(t,a,e,i,r){var o="emergeRotate"+ ++s;return'<div style="position: absolute; transition: opacity '+r+'ms ease-out"><div style="position: absolute; left: 50%; top: 50%; margin: -'+t+'px"><svg xmlns="http://www.w3.org/2000/svg" width="'+2*t+'" height="'+2*t+'"viewBox="0 0 24 24" style="-webkit-animation: '+o+" "+i+"ms linear infinite;animation: "+o+" "+i+'ms linear infinite"><path fill="'+a+'" d="M17.25 1.5c-.14-.06-.28-.11-.44-.11-.55 0-1 .45-1 1 0 .39.23.72.56.89l-.01.01c3.2 1.6 5.39 4.9 5.39 8.71 0 5.38-4.37 9.75-9.75 9.75S2.25 17.39 2.25 12c0-3.82 2.2-7.11 5.39-8.71v-.02c.33-.16.56-.49.56-.89 0-.55-.45-1-1-1-.16 0-.31.05-.44.11C2.9 3.43.25 7.4.25 12c0 6.4
@Tblue
Tblue / mozlz4a.py
Last active Oct 3, 2019
MozLz4a compression/decompression utility
View mozlz4a.py
#!/usr/bin/env python
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
# This file format is in fact just plain LZ4 data with a custom header (magic number [8 bytes] and
# uncompressed file size [4 bytes, little endian]).
#
# This Python 3 script requires the LZ4 bindings for Python, see: https://pypi.python.org/pypi/lz4
#
@beshur
beshur / hsb.scss
Created Nov 14, 2014
Sass: HSB to HSL converter
View hsb.scss
// Simple HSB to HSL converter by Alexander Futekov (@futekov)
// http://www.sitepoint.com/hsb-colors-with-sass/
//
@function hsb($h-hsb, $s-hsb, $b-hsb, $a: 1) {
@if $b-hsb == 0 {
@return hsla(0, 0, 0, $a)
} @else {
$l-hsl: ($b-hsb/2) * (2 - ($s-hsb/100));
$s-hsl: ($b-hsb * $s-hsb) / if($l-hsl < 50, $l-hsl * 2, 200 - $l-hsl * 2);
@return hsla($h-hsb, $s-hsl, $l-hsl, $a);
@fabrizim
fabrizim / acf-customizer-patch.php
Last active Jul 10, 2019
Plugin to allow for Advanced Custom Fields to be used in widgets within the Customizer
View acf-customizer-patch.php
<?php
/*
Plugin Name: ACF Customizer Patch
Plugin URI: https://gist.github.com/fabrizim/9c0f36365f20705f7f73
Description: A class to allow acf widget fields to be stored with normal widget settings and allow for use in customizer.
Author: Mark Fabrizio
Version: 1.0
Author URI: http://owlwatch.com/
*/
class acf_customizer_patch
View beautiful_idiomatic_python.md

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@jtriley
jtriley / terminalsize.py
Created Jul 26, 2011
Get current terminal size on Linux, Mac, and Windows
View terminalsize.py
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
@bueltge
bueltge / post-process.php
Created Jun 24, 2011
WordPress Custom Post Type: Insert post via Frontend
View post-process.php
<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
@derpixler
derpixler / wp-coustom-term-options.php
Created May 25, 2011
Wordpress Hooks to add coustom term Options
View wp-coustom-term-options.php
<?php
/**
*
* Add only for parents coustom term Options
* @author rene reimann
* @home http://www.rene-reimann.de
*
* @hook category_add_form_fields Hooks into the category edit page
* @hook edit_tag_form_fields Hooks into the category frontpage
@miya0001
miya0001 / switchTheme.php
Created May 10, 2011
switch theme class for wordpress plugin
View switchTheme.php
<?php
class switchTheme {
private $name = null;
private $dir = null;
private $url = null;
function __construct($name = null, $dir = null, $url = null)
{
$this->name = $name;
You can’t perform that action at this time.