Skip to content

Instantly share code, notes, and snippets.

View codecandies's full-sized avatar
😸
Pffffft.

Nico Brünjes codecandies

😸
Pffffft.
View GitHub Profile
@codecandies
codecandies / counting-12345.js
Last active December 21, 2015 21:19
click event counting example
button.onclick = function() {
// ga tracking, same on both sites
if( window._gaq !== undefined ) {
_gaq.push(['_trackEvent', 'liveblogs', 'reload', window.location.href]);
}
// mobile ivw counting?
if( typeof iom !== 'undefined' && typeof iam_data !== 'undefined' ) {
// IVW Version 2.0
iom.c(iam_data,1);
// cms click counter
@codecandies
codecandies / package.json
Created September 12, 2013 08:02
example of an grunt.js package.json
{
"name": "gruntdemo",
"version": "0.0.0",
"description": "Demo project using grunt.js.",
"main": "src/gruntdemo.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": "",
"author": "Meri",
@codecandies
codecandies / Gruntfile.js
Created September 12, 2013 08:18
the basic do-nothing Gruntfile.js
//Wrapper function with one parameter
module.exports = function(grunt) {
// What to do by default. In this case, nothing.
grunt.registerTask('default', []);
};
@codecandies
codecandies / mobile_redirect.js
Created September 24, 2013 06:57
The parts of the ZEIT-Library responsible for mobile redirecting.
window.myagent = navigator.userAgent||navigator.vendor||window.opera;
window.is_mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(window.myagent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno
# Add a little color to your git cli
git config --global color.ui auto
# Git will automatically manage line endings for you if you set autocrlf option
# on a mac / linux machine you'll want do this
git config --global core.autocrlf input
# one a windows machine you'll want to do this
git config --global core.autocrlf true
# Instead of just showing highlighting the entire line that changed
@codecandies
codecandies / click.js
Created October 8, 2013 12:52
Ausschnitt aus http://static.zeit.de/static/js/loader.js Klicktracking Beispiel
// Ausschnitt aus http://static.zeit.de/static/js/loader.js
// Aufruf like: ZEIT.clickIVW( true );
var ZEIT = function() {
return {
clickCC: function () { // loads 1 pixel for internal click counter
// http://cc.zeit.de/cc.gif?banner-channel=kultur/film/gallery&r='+escape(document.referrer)+'&rand='+Math.random()*10000000000000000
var ccimg = document.createElement('img');
var bc = jQuery("body").attr('data-banner_channel') || "";
var src = 'http://cc.zeit.de/cc.gif?banner-channel=' + bc + '&r=' + escape(document.referrer) + '&rand=' + Math.random()*10000000000000000;
ccimg.src = src;
/* the ZEIT namespace */
var ZEIT = function() {
return {
BrightcovePlayerPlugin : {
pluginInitialised : function (argument) {
if ( ZEIT.getQueryVar( "debug" ) == "true" ) {
console.info("[brightcove - ZEITPixel Plugin] plugin initialised");
}
},
playerLoaded : function(videoInfo) {
stylesheets/
|
|-- modules/ # Common modules
| |-- _all.scss # Include to get all modules
| |-- _utility.scss # Module name
| |-- _colors.scss # Etc...
| ...
|
|-- partials/ # Partials
| |-- _base.sass # imports for all mixins + global project variables
stylesheets/
|
|-- admin/ # Admin sub-project
| |-- modules/
| |-- partials/
| `-- _base.scss
|
|-- account/ # Account sub-project
| |-- modules/
| |-- partials/
@codecandies
codecandies / scaffold.html
Last active August 29, 2015 14:06
HTML Boilerplate
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="{lang|default:de}" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="{lang|default:de}" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="{lang|default:de}" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="{lang|default:de}" class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<!-- Frage: Können wir das X-UA-Compatible nicht auch via Header schicken? -->
<!-- meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible' -->
<title>{title}</title>