Skip to content

Instantly share code, notes, and snippets.

@BlackSkorpio
BlackSkorpio / jquery.add-body-class.js
Created December 11, 2018 22:23 — forked from mware/jquery.add-body-class.js
add body class based on the url using RegEx
/* add body class */
var loc = window.location.pathname.match(/^\/?(\w+)\b/);
if(loc) $(document.body).addClass(loc[1].toLowerCase());
@BlackSkorpio
BlackSkorpio / isElementInViewport.js
Created December 5, 2018 20:32 — forked from davidtheclark/isElementInViewport.js
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
@BlackSkorpio
BlackSkorpio / string-utils.js
Created November 3, 2018 00:33 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
return str.toLowerCase();
@BlackSkorpio
BlackSkorpio / fieldset.css
Created October 11, 2018 18:46 — forked from wpsmith/fieldset.css
CSS: Cross-browser styling of <fieldset> and <legend> without any additional HTML elements
/*
Cross-browser styling of <fieldset> and <legend> without any additional HTML elements
basic rules:
- fieldset cannot have padding, because it would ruin the legend absolute positioning in Gecko
- cannot use relative positioning on legend, because it does not work in Opera
- legend cannot have padding, because it would break its 100% size in all browsers.
this cannot be fixed by overflow:hidden, because it is stupid in all IE
- selector priority in IE7 is wrong (!important)
*/
$("#column_center .odd:empty").remove();
$("#column_center .even:empty").remove();
@BlackSkorpio
BlackSkorpio / firefox-bm-ah.css
Created June 17, 2018 12:24 — forked from ecornell/firefox-bm-ah.css
Firefox - Auto-hide Bookmark Bar | Works with Stylish
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#PersonalToolbar {
visibility: collapse !important;
opacity: 0.01;
-moz-transition: visibility 0.5s, opacity 0.5s ease !important;
position: fixed !important;
width: 100% !important;
padding: 3px 3px 3px 3px !important;
z-index: 10;
@BlackSkorpio
BlackSkorpio / gist:1d3c24615abcb8c84b04121d5299c134
Created September 17, 2016 22:29 — forked from MrDys/gist:3512455
Link directly to an open modal window in Bootstrap
/* If you've ever had the need to link directly to an open modal window with Bootstrap, here's a quick and easy way to do it:
Make sure your modal has an id:
<div class="modal" id="myModal" ... >
Then stick this bit of Javascript at at the end of your document:
*/
$(document).ready(function() {
@BlackSkorpio
BlackSkorpio / ocp.php
Created July 13, 2016 14:29 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@BlackSkorpio
BlackSkorpio / phprc
Created July 13, 2016 09:12 — forked from rfmeier/phprc
Enable opcache on DreamHost for php 5.5 and greater
[opcache]
; the path to the .so file
zend_extension=opcache.so
; Enabled. Set to 0 to disable
opcache.enable=1
; Max memory consumption. Default 32 megs
opcache.memory_consumption=32
@BlackSkorpio
BlackSkorpio / phprc
Created July 13, 2016 09:12 — forked from amnuts/phprc
Dreamhost PHP 5.6 phprc file
date.timezone = "Europe/London"
expose_php = 0
extension = phar.so
extension = fileinfo.so
extension = intl.so
suhosin.executor.include.whitelist = phar
[opcache]
zend_extension=opcache.so