Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Joerg Schoeneburg jswebschmiede

🏠
Working from home
View GitHub Profile
@jswebschmiede
jswebschmiede / snippet.js
Created Sep 6, 2012 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
View snippet.js
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
* Tip: http://pivotallabs.com/users/jdean/blog/articles/1400-working-with-asynchronously-loaded-javascript
*/
(function(doc, script) {
var js,
@jswebschmiede
jswebschmiede / gist:4046054 Cross-Browser ::before and ::after pseudo-class polyfill
View gist:4046054
/* =============================================================================
CSS Declarations
========================================================================== */
/* ==|== The Standard Way =================================================== */
.foo::before {
/* ...css rules... */
}
@jswebschmiede
jswebschmiede / navobject.css
Created Nov 12, 2012
A CSS object for many nav styles
View navobject.css
/** the nav object **/
.nav {}
.nav ul { margin-bottom: 0; }
.nav li {
list-style: none;
list-style-image: none;
margin-left:0;
}
/** nav object for horizontal navigations **/
.nav.horizontal ul,
@jswebschmiede
jswebschmiede / array.php
Created Nov 16, 2012
Jedes 2. Element / Jedes X-te Element im Array
View array.php
// Array
$array = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
foreach($array as $key => $value) {
if(($key%2)===0 && $key > 0) {
echo $value;
}
}
View mq.css
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@jswebschmiede
jswebschmiede / base.js
Created Dec 18, 2012
Cross-Browser Placeholder Support, auch für Passwort Felder im IE, mit Modernizr.
View base.js
/* Modernizr load */
Modernizr.load({
test : Modernizr.input.placeholder,
nope : './js/ext/placeholderfix.js'
});
View wp8-ie10-fix.js
(function() {
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement("style");
msViewportStyle.appendChild(
document.createTextNode("@-ms-viewport{width:auto!important}")
);
document.getElementsByTagName("head")[0].appendChild(msViewportStyle);
}
})();
@jswebschmiede
jswebschmiede / cross_minmax_width.css
Created Mar 26, 2013
Cross Browser min-widht and max-width
View cross_minmax_width.css
/* this CSS create a minimum width of 750px: */
#wrapper {
min-width: 750px;
width:expression(document.body.clientWidth < 750? "750px": "auto" );
}
/* this CSS create a minimum width of 750px and a max-width of 1220px */
#wrapper {
min-width: 750px;
max-width: 1220px;
View sass-HiDPI-images.scss
/**
* Author: @joostkiens
* Licensed under the MIT license
*/
@mixin hr-image($image, $width, $height) {
@media print,
(-webkit-min-device-pixel-ratio: 1.25),
(-o-min-device-pixel-ratio: 5/4),
(min-resolution: 120dpi) {
background-image: url($image);
@jswebschmiede
jswebschmiede / scrollto.js
Created Apr 17, 2013
scroll to element with jQuery
View scrollto.js
function scrollToEle($ele) {
var x = $($ele).offset().top;
$('html,body').animate({scrollTop: x}, 500);
}
$(document).ready(function(){
scrollToEle('#test-div');
});