Skip to content

Instantly share code, notes, and snippets.

// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// _config.scss
$base-font-size: 16px;
$support-legacy: true;
@mixin rem($value, $base: $base-font-size) {
@pascalmaddin
pascalmaddin / get_posts_from_category.php
Created June 23, 2014 13:16
WordPress: get posts from category (including some args)
query_posts( array( 'category__and' => array($cat_id), 'posts_per_page' => 1, 'orderby' => 'rand' ) );
while (have_posts()) : the_post();
// show stuff here
endwhile;
wp_reset_query();
@pascalmaddin
pascalmaddin / consolelog.js
Created June 2, 2014 12:25
This tiny bit of code will help you identify where the logging is being called from. The nice thing is it works in the browser and in node. Source: http://remysharp.com/2014/05/23/where-is-that-console-log/
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
var stack = (new Error()).stack.split(/\n/);
// Chrome includes a single "Error" line, FF doesn't.
if (stack[0].indexOf('Error') === 0) {
stack = stack.slice(1);
}
var args = [].slice.apply(arguments).concat([stack[1].trim()]);
return old.apply(console, args);
@pascalmaddin
pascalmaddin / svg-with.png-fallback.js
Created May 28, 2014 07:15
Fallback für svg-Grafiken mit Modernizr
if(!Modernizr.svg) {
$('img[src$="svg"]').attr('src', function() {
return $(this).attr('src').replace('.svg', '.png');
});
}
@pascalmaddin
pascalmaddin / terminal-prompt
Created February 7, 2014 14:05
my terminal prompt
# change prompt
export PS1=$'\n\[\033[0;36m\]\u\[\033[0m\]: \[\033[1;33m\]\w\[\033[0m\] \n\xe2\x86\x92 '
@pascalmaddin
pascalmaddin / bash_profile_colors
Created February 7, 2014 14:04
prompt colors for .bash_profile
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
@pascalmaddin
pascalmaddin / check_if_element_has_class.js
Created January 28, 2014 07:57
Here is a little snippet if you're trying to check wether element contains a class, without using jQuery. From http://sonnyt.com/javascript-check-if-element-has-class/
function hasClass(element, className) {
return element.className && new RegExp("(^|\\s)" + className + "(\\s|$)").test(element.className);
}
@pascalmaddin
pascalmaddin / redirect_after_login.php
Created October 10, 2013 15:49
Leitet einen Nutzer nach der Registrierung auf eine beliebige Seite weiter
function __my_registration_redirect(){
return home_url( '/my-page' );
}
add_filter( 'registration_redirect', '__my_registration_redirect' );
@pascalmaddin
pascalmaddin / js-slider.html
Created June 17, 2013 09:54
Really simple jQuery-Slider. Just the basic structure.
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>The Obligatory Slider</title>
<style>
body {
width: 600px;
margin: 100px auto 0;
}
@pascalmaddin
pascalmaddin / parallax-image-with-text.html
Last active May 14, 2021 14:38
An Image with parallax-effect and with some text, which is fading out while scrolling
<div id="banner">
<div class="wrap-center">
<div class="banner-centered" id="banner-text">
<h2>Hello <strong>We Are Company-Name</strong>, Glad To See You. :-)</h2>
</div>
</div>
</div>