Skip to content

Instantly share code, notes, and snippets.

View Haraldson's full-sized avatar

Hein Haraldson Berg Haraldson

View GitHub Profile
h1 {
@include responsive-property('font-size', 32);
}
@mixin responsive-property($property, $pxValue) {
#{$property}: #{$pxValue}px;
@media only screen and (max-width: #{$containerW}px) {
#{$property}: $pxValue * 0.1rem;
#{$property}: $pxValue * (100 / $containerW) * 1vw;
}
@Haraldson
Haraldson / Gruntfile.js
Created September 4, 2013 07:53
SASS watch.
module.exports = function(grunt)
{
grunt.initConfig(
{
pkg: grunt.file.readJSON('package.json'),
watch: {
css: {
files: ['www/assets/css/sass/*.scss'],
tasks: ['sass']
define(['backbone', 'router', 'handlebars'], function(Backbone, QuizRouter, Handlebars)
{
var CommonView = Backbone.View.extend(
{
initialize: function(options)
{
_.bindAll(this);
if(this.init && _.isFunction(this.init))
{
@Haraldson
Haraldson / questionView.js
Created August 28, 2013 08:55
Quiz View > question view
define(['backbone', 'handlebars', 'commonview', 'quiz/host/collection/question-alternatives', 'quiz/host/model/question-alternative', 'quiz/host/view/question-alternative-collection', 'text!quiz/host/template/question.hbs'],
function(Backbone, Handlebars, CommonView, QuestionAlternativeCollection, QuestionAlternativeModel, QuestionAlternativeCollectionView, QuestionTemplate)
{
var QuestionView = CommonView.extend(
{
socketEvents: {
'hostTask': 'populate'
},
init: function()
@Haraldson
Haraldson / init.js
Created August 12, 2013 11:06
Quiz application using cool JS techs.
requirejs.config(
{
appDir: '../',
baseUrl: 'assets/js/lib/',
paths: {
app: '../app'
},
shim: {
'lodash': {
protected $serviceContainer;
protected $pageService;
public function __construct($serviceContainer)
{
$this->serviceContainer = $serviceContainer;
$this->pageService = $this->serviceContainer->getPageService();
}
@Haraldson
Haraldson / gist:5501897
Created May 2, 2013 12:33
Stack trace: Twig_Error_Runtime
in kernel.root_dir/cache/dev/classes.php at line 6047
at Twig_Template ->displayWithErrorHandling (array('noLayout' => true, 'content' => object(Content), 'viewbaseLayout' => 'EzPublishCoreBundle::viewbase_layout.html.twig', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'ezpublish' => object(GlobalHelper), 'app' => object(GlobalVariables)), array())
in kernel.root_dir/cache/dev/classes.php at line 6017
at Twig_Template ->display (array('noLayout' => true, 'content' => object(Content), 'viewbaseLayout' => 'EzPublishCoreBundle::viewbase_layout.html.twig'))
in kernel.root_dir/cache/dev/classes.php at line 6024
at Twig_Template ->render (array('noLayout' => true, 'content' => object(Content), 'viewbaseLayout' => 'EzPublishCoreBundle::viewbase_layout.html.twig'))
in /Users/hhb/www/ez5-projects/product-sites/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php at line 53
at TwigEngine ->render ('KTQProductSitesBundle:particles:link.html.
@Haraldson
Haraldson / product.html.twig
Created May 2, 2013 12:31
Failing product template
{% extends noLayout ? viewbaseLayout : 'KTQProductSitesBundle::pagelayout.html.twig' %}
{% block content %}
{% set pricesOrderContentId = content.getField('link_prices_order').value.destinationContentId %}
{% set freeTrialContentId = content.getField('link_free_trial').value.destinationContentId %}
<div class="product landing span12">
<div class="row">
<div class="header span12">
<div class="row">
<div class="span5">
<h1>{{ ez_render_field(content, 'name') }}</h1>
@Haraldson
Haraldson / imagegallery.php
Created February 24, 2013 22:44
Bildegalleri som baserer seg på at bilder hentes fra DAM basert på tags som lagres av redaktør i CMS.
<?php
require_once(CLASSES_ROOT.'/mediabase/api/kmcontroller.php');
require_once(CLASSES_ROOT.'/mediabase/keymedia.php');
require_once(CLASSES_ROOT.'/system/mediabase/kpmediabase.php');
class CustomerImageGalleryGUI
{
protected $mb;
protected $tpl;
@Haraldson
Haraldson / ekornes-tabs.js
Created February 24, 2013 22:40
Faner med AJAX-innlasting av innhold som sett på ekornes.no før nettstedet ble flyttet.
if(typeof jQuery !== 'undefined')
{
function Tabs(args)
{
if($(args.selector.wrap).length)
{
this.init(args);
}
}