Skip to content

Instantly share code, notes, and snippets.

View Ahrengot's full-sized avatar
🤟

Jens Ahrengot Boddum Ahrengot

🤟
View GitHub Profile
// Set model answar prop and check if answar is correct
this.questions.at( this.model.get("index") ).set( "answar", {
allPointsCorrect: _.all( draggables, function() { return $(this.target).data("accepted"); } ),
coords: _.map( draggables, function() { return $(this.target).data( "position" ); } )
});
var SPEED = 200;
var JET = 420;
var GRAVITY = 900;
var OPENING = 200;
var SPAWN_RATE = 1.25;
var state = {
preload: function() {
this.load.image( "wall", "assets/wall.png" );
this.load.image( "background", "assets/background-texture.png" );
define ["underscore"], (_) ->
class ResponsiveImagesController
currImgSize: "small"
breakpoint: 480
constructor: (@images) ->
@debouncedHandleResize = _.debounce( @handleResize, 500 )
@bindEvents()
@handleResize()
bindEvents: ->
$(window).on( "resize.responsive-images", @debouncedHandleResize )
<?php
$first_date = "{event_last_date format="%Y%m%d"}";
$next_week = date( "Ymd", strtotime( "+1 Sunday 23:59" ) );
$today = date( "Ymd", strtotime( "now" ) );
echo "<p>First date: " . $first_date . "<br>";
echo "next_week: " . $next_week . "<br>";
echo "today: " . $today . "</p>";
@Ahrengot
Ahrengot / staggered-animation.scss
Last active December 1, 2016 20:02
Staggered animation using SASS & Compass
li {
@for $i from 1 through 10 {
&:nth-child(#{$i}) {
@include experimental(animation-delay, #{$i * 0.2}s);
}
}
}
define ["underscore", "model/Rectangle"], (_, Rectangle) ->
class ConfigRuleBook
constructor: () ->
# Relationship between fronts and shelves
@frontShelfRelationship =
"skuffe_1x05": "hylde_1"
"skuffe_1x1": "hylde_1"
"bakker_1": "hylde_1"
"skuffe_2x1": "hylde_2"
"klap_2x1": "hylde_2"
(function() {
define(["underscore", "view/elements/DrawerElement"], function(_, DrawerElementView) {
var ConfigurationLoader;
ConfigurationLoader = (function() {
function ConfigurationLoader() {
_.bindAll(this);
this.load();
}
ConfigurationLoader.prototype.getConfigId = function() {
define ["underscore", "view/elements/DrawerElement"], (_, DrawerElementView) ->
class ConfigurationLoader
constructor: ->
_.bindAll @
@load()
getConfigId: ->
regex = ///
(.+?) # Match anything before config/
config/ # Match "config/"
@Ahrengot
Ahrengot / require.coffee
Created August 6, 2013 12:02
Require a file with require.js
# Here's the method. Filename should be written without the .js extention, so to load a file called
# Main.js you'd type require ["Main"]
require ["url/to/thing/"], ->
# Thing has now been loaded. Continue on
## If you need a reference to the object you just loaded (If the JS file returns an object etc.) you can catch it like this
require ["path/to/thing"], (Thing) ->
window.thing = new Thing()
// Generated by CoffeeScript 1.3.1
(function() {
var SliderControl,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
SliderControl = (function() {
SliderControl.name = 'SliderControl';
function SliderControl(el) {