Skip to content

Instantly share code, notes, and snippets.

View arjaneising's full-sized avatar

Arjan Eising arjaneising

View GitHub Profile
@arjaneising
arjaneising / markfont.scss
Last active December 31, 2015 12:09
See file itself.
// Mockup of a mixin to usee along the Web Font Loader.
// Per font, you hardcode a mixin (can be optimized, go ahead!). In the mixin, the default font is something like Times or Arial. By fiddling a bit later on, you can determine the optical ratio between the rendered height of your font, and the fallback.
// Put that on the place of the 0.95.
// When the WFL finishes loading, it will set a class on the root element. Because you have selected a version of the font, for example a bold or italic one, you have to re-set all the font options related to that. Otherwise you will get a fake bold.
// So, while the font is loading (can take 2-5 seconds on slow, mobile connections, but also on desktop!) you will see the fallback font, instead of a void for all places your font is used.
@arjaneising
arjaneising / shift.rb
Created November 26, 2012 22:10 — forked from derekkraan/shift.rb
Move all files with number greater than argument
def new_filename(num, filename)
if num.to_i < 9
"_0#{num.to_i+1}#{filename}"
elsif num.to_i < 99
"_#{num.to_i+1}#{filename}"
else
"#{num.to_i+1}#{filename}"
end
end
@arjaneising
arjaneising / widget_css_heper.php
Created March 29, 2012 08:52
CakePHP CSS helper, returns a string with all possible basic CSS properties
<?php
/**
* Helper to specify ALL CSS to make sure it won't get overwritten on the 'host' site.
*/
class WidgetCssHelper extends AppHelper {
/**
* @param $styles Array with the style of the element
* @param bool $noDefaults boolean, must the default css be loaded?
* @return string Css with the css rules
@arjaneising
arjaneising / scoping.js
Created February 24, 2012 13:48
JS Scoping trick
var forUserFunctions = (function(window, document) {
var privateElm = document.getElementById('supersekrit');
function setNewText(newText) {
privateElm.innerHTML = newText;
}
function capitalize() {
privateElm.innerHTML = privateElm.innerHTML.toUpperCase();
}
@arjaneising
arjaneising / route_url_helper.php
Created January 7, 2012 14:58
Routed URL helper for CodeIgniter
<?php
function route_url($segments, $slash = true) {
$CI =& get_instance();
$routes = $CI->router->routes;
$toReturn = false;
foreach ($routes as $route => $arch) {