Skip to content

Instantly share code, notes, and snippets.

@MrDys
MrDys / gist:3512455
Created August 29, 2012 13:26
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() {
@mware
mware / jquery.add-body-class.js
Created November 20, 2012 16:12
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());
@ck-on
ck-on / ocp.php
Last active May 18, 2024 22:35
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
@zenorocha
zenorocha / multiple-3rd-party-widgets.js
Last active November 14, 2022 12:18
Loading multiple 3rd party widgets asynchronously
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@tdominey
tdominey / gist:5285143
Last active December 15, 2015 15:49
Loading featured album in koken:background
<style>
.thumb {
width:400px;
height:300px;
}
</style>
<koken:load source="featured_albums">
<koken:loop>
<koken:background class="thumb">
@davidtheclark
davidtheclark / isElementInViewport.js
Created May 4, 2013 02:00
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 &&
@ecornell
ecornell / firefox-bm-ah.css
Last active February 21, 2024 20:03
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;
@wpsmith
wpsmith / fieldset.css
Last active October 11, 2018 18:46 — forked from paranoiq/aaa.txt
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)
*/
@tdominey
tdominey / gist:6543642
Created September 12, 2013 20:53
Use {{ location.here }} variable to know which page you're viewing
<koken:if data="location.here" equals="/">
<!-- We're on the home page -->
</koken:if>
<koken:if data="location.here" equals="/albums/">
<!-- We're on the albums index -->
</koken:if>
<koken:if data="location.here" equals="/albums/portraits/">
<!-- We're on the portraits album page -->
@tdominey
tdominey / gist:6900672
Created October 9, 2013 12:44
Load a flat list of all Library albums without parent sets
<koken:load source="albums" filter:flat="true>
<koken:loop>
<koken:if data="{{ album.album_type }}" equals="standard">
{{ album.title }}
</koken:if>
</koken:loop>
</koken:load>