Skip to content

Instantly share code, notes, and snippets.

@MoritzBuetzer
MoritzBuetzer / figcaption.css
Created May 7, 2014 06:26
figcaption restricted to the width of a responsive image
figure {
padding: 5px;
display: table;
}
figure img {
display: block;
}
figcaption {
@MoritzBuetzer
MoritzBuetzer / orientationchange.js
Last active August 29, 2015 14:03
orientationchange
window.addEventListener('orientationchange', handleOrientation, false);
function handleOrientation() {
if (orientation == 0) {
//portraitMode
} else if (orientation == 90) {
//landscapeMode
} else if (orientation == -90) {
//landscapeMode
} else if (orientation == 180) {
@MoritzBuetzer
MoritzBuetzer / inArray.js
Created July 10, 2014 11:46
Check if value is in Array
Array.prototype.inArray = function (value) {
var i;
for (i=0; i < this.length; i++) {
if (this[i] === value) {
return true;
}
}
return false;
};
@MoritzBuetzer
MoritzBuetzer / limiter.js
Created July 10, 2014 11:52
simple script to limit chars in textfield
function($) {
$.fn.extend( {
limiter: function(limit, elem) {
$(this).on("keyup focus", function() {
setCount(this, elem);
});
function setCount(src, elem) {
var chars = src.value.length;
if (chars > limit) {
src.value = src.value.substr(0, limit);
@MoritzBuetzer
MoritzBuetzer / pagination.html
Created July 10, 2014 11:53
pagination with foundation 5
<ul class="pagination">
<li class="arrow unavailable"><a href="">&laquo;</a></li>
<li class="current"><a href="">1</a></li>
<li><a href="">2</a></li>
<li><a href="">3</a></li>
<li><a href="">4</a></li>
<li class="unavailable"><a href="">&hellip;</a></li>
<li><a href="">12</a></li>
<li><a href="">13</a></li>
<li class="arrow"><a href="">&raquo;</a></li>
@MoritzBuetzer
MoritzBuetzer / topbar.html
Created July 10, 2014 12:03
foundation 5 topbar
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name"><h1><a href="#">Something</a></h1></li>
<li class="toggle-topbar menu-icon"><a href="#">Menu</a></li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li class="active"><a href="#">Right Nav Button Active</a></li>
@MoritzBuetzer
MoritzBuetzer / Default (OSX).sublime-keymap
Last active November 21, 2017 09:43
Sublime Text 3 Settings
[
{
"keys": ["super+shift+e"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"},
"keys": ["super+shift+p"], "command": "prompt_select_workspace",
"keys": ["ctrl+shift+p"], "command": "show_overlay", "args": {"overlay": "command_palette"}
}
]
@MoritzBuetzer
MoritzBuetzer / jQuery.fn.quickEach.js
Created November 4, 2014 13:56
The 'quickEach' method will pass a non-unique jQuery instance to the callback meaning that there will be no need to instantiate a fresh jQuery instance on each iteration.
jQuery.fn.quickEach = (function(){
var jq = jQuery([1]);
return function(c) {
var i = -1, el, len = this.length;
try {
while (
++i < len &&
(el = jq[0] = this[i]) &&
c.call(jq, i, el) !== false
);
@MoritzBuetzer
MoritzBuetzer / app.js
Created November 19, 2014 13:43
Fix anchor Links in jQuery Mobile App
$( document ).on( "pagebeforeshow", function() {
$('a[href*="#anchor"]').attr('data-ajax','false');
});
@MoritzBuetzer
MoritzBuetzer / updatet3.sh
Created January 22, 2015 13:25
simple TYPO3 update script
#!/bin/sh
if [ ! -d "typo3_src-$*" ]; then
echo "download typo3 source"
wget http://get.typo3.org/$*
echo "unzip typo3 source"
tar xfz typo3_src-$*.tar.gz
rm -rf typo3_src-$*.tar.gz
fi
echo "unlink previous typo3 source"
unlink typo3_src