Skip to content

Instantly share code, notes, and snippets.

View Quinten's full-sized avatar
🔭
restless

Quinten Clause Quinten

🔭
restless
View GitHub Profile
@Quinten
Quinten / cross-browser opacity
Created June 10, 2013 12:44
cross-browser opacity
#element {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
-moz-opacity: 0.3;
-khtml-opacity: 0.3;
opacity: 0.3;
}
@Quinten
Quinten / css transition and box-shadow
Created June 6, 2013 09:11
float in transition in css (and a good looking boxshadow)
#element {
position: absolute;
top: 102px;
background: #fff;
opacity: 0;
visibility: hidden;
transition-property: top,opacity;
transition-duration: 0.4s;
transition-timing-function: ease-in-out;
-webkit-transition-property: top,opacity;
@Quinten
Quinten / css triangle tooltip
Last active July 26, 2022 14:35
tooltip triangle on the top of an element in css
#element:before {
content: "";
position: absolute;
width: 0;
height: 0;
border-left: 16px solid transparent;
border-right: 16px solid transparent;
border-bottom: 16px solid #fff;
top: -15px;
left: 27px;
@Quinten
Quinten / properXML
Created June 6, 2011 13:01
aggressive formatting for xml in php. Seems to solve most of the encoding and html entity problems. experimental
function properXML($str){
//return iconv("UTF-8", "ISO-8859-1//TRANSLIT", preg_replace("/&/", "and", html_entity_decode(strip_tags($str), ENT_COMPAT, 'UTF-8')));
return utf8_encode(preg_replace("/&/", "and", html_entity_decode(strip_tags($str), ENT_COMPAT, 'UTF-8')));
}
@Quinten
Quinten / object_property_sort
Created May 9, 2011 15:00
sort an array of objects on the values of certain properties in mysql style
// sort an array of objects on the values of certain properties
// Usage: $obj_list = object_property_sort($obj_list, "title ASC");
function object_property_sort($obj_arr, $order_by) {
$sort = explode(" ", $order_by);
$property = $sort[0];
$dir = ($sort[1] == "ASC") ? SORT_ASC : SORT_DESC;
$sort_on_arr = array();
foreach($obj_arr as $key => $object)
$to_sort_arr[(string)$key] = $object->$property;
@Quinten
Quinten / shuffle_assoc
Created May 9, 2011 10:59
shuffle an array while preserving keys
<?php
function shuffle_assoc($list) {
if (!is_array($list)) return $list;
$keys = array_keys($list);
shuffle($keys);
$random = array();
foreach ($keys as $key)
$random[$key] = $list[$key];
return $random;
@Quinten
Quinten / inline-block-IE
Created April 21, 2011 12:46
inline-block in IE (finally)
li {
display: -moz-inline-stack; /* Firefox 2 */
display: inline-block;
zoom: 1; /* IE hack to trigger hasLayout */
*display: inline; /* IE hack to achieve inline-block behavior */
}