Skip to content

Instantly share code, notes, and snippets.

View andi1984's full-sized avatar
🏠
Working from home

Andreas Sander andi1984

🏠
Working from home
View GitHub Profile
@andi1984
andi1984 / MySingleton.js
Created March 1, 2016 08:59 — forked from jasonwyatt/MySingleton.js
Singleton Pattern with Require JS
define(function(){
var instance = null;
function MySingleton(){
if(instance !== null){
throw new Error("Cannot instantiate more than one MySingleton, use MySingleton.getInstance()");
}
this.initialize();
}
@andi1984
andi1984 / reverb.rb
Created October 18, 2015 18:42
Sonic Pi - Second workout
live_loop :background do
with_fx :slicer, phase_slide: 100 do |fx|
background_samples = [:bass_trance_c, :bass_thick_c, :ambi_swoosh, :ambi_piano]
s = sample background_samples.choose
control fx, phase: rand(), mix: rrand(0.75, 1), res: rand(1)
control s, pan: rrand(-1,1)
end
sleep 0.5
end
@andi1984
andi1984 / sample.rb
Created October 18, 2015 18:34
Sonic Pi - First workout
live_loop :background do
with_fx :ixi_techno, phase_slide: 100 do |fx|
background_samples = [:bass_trance_c, :bass_thick_c, :ambi_swoosh, :ambi_piano]
s = sample background_samples.choose
control fx, phase: rand(), mix: rrand(0.75, 1), res: rand(1)
control s, pan: rrand(-1,1)
end
sleep 0.5
end
@andi1984
andi1984 / what-forces-layout.md
Created October 5, 2015 21:10 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@andi1984
andi1984 / grunt-modules.txt
Last active September 2, 2015 21:06
Grunt Must-Havs
npm install --save-dev load-grunt-tasks
npm install grunt-bowercopy --save-dev
@andi1984
andi1984 / surface.css
Created August 27, 2015 07:10
Responsive Microsoft Surface
@-ms-viewport{width:device-width}
@andi1984
andi1984 / vine.php
Last active August 29, 2015 14:17 — forked from marczobec/vine.php
<?php
kirbytext::$tags['vine'] = array(
'attr' => array(
'size'
),
'html' => function($tag) {
$vineURL = $tag->attr('vine');
$size = $tag->attr('size', '300');
[alias]
ci = commit
lc = log ORIG_HEAD.. --stat --no-merges
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
llog = log --date=local
changes = diff --name-status -r
diffstat = diff --stat -r
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
@andi1984
andi1984 / styles.css
Last active August 29, 2015 14:08 — forked from pburtchaell/styles.css
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
@andi1984
andi1984 / symfony_debug
Last active August 29, 2015 14:08
Access logger inside a controller.
<?php
$logger = $this->get('logger');
$logger->info('Hello World');