Skip to content

Instantly share code, notes, and snippets.

View yvesvanbroekhoven's full-sized avatar

Yves Van Broekhoven yvesvanbroekhoven

View GitHub Profile
@yvesvanbroekhoven
yvesvanbroekhoven / application_helper.rb
Created November 9, 2011 10:44
Basic front end Ruby on Rails helpers (created for own CMS Lalala)
# Returns css class for <body>
def body_class
body_class = []
body_class << params[:controller].gsub('_','-')
body_class << params[:action].gsub('_','-')
body_class << @body_class if @body_class
body_class.join(' ')
end
# Returns class_name if x equals y
@yvesvanbroekhoven
yvesvanbroekhoven / preinitializer.rb
Created November 14, 2011 08:58
Rails 1.9.2 character fix
# ...
if defined? Encoding
Encoding.default_external = 'utf-8'
Encoding.default_internal = 'utf-8'
require 'yaml'
YAML::ENGINE.yamler= 'syck'
end
<script type="text/javascript">
TypekitConfig = {
kitId: 'YOUR_TYPE_KIT_ID',
scriptTimeout: 3000
};
(function(){var h=document.getElementsByTagName('html')[0];h.className+=' wf-loading';var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wf-loading(\s|$)/g,'');h.className+=' wf-inactive';},TypekitConfig.scriptTimeout);var tk=document.createElement('script');tk.src='//use.typekit.com/'+TypekitConfig.kitId+'.js';tk.type='text/javascript';tk.async='true';tk.onload=tk.onreadystatechange=function(){var rs=this.readyState;if(rs&&rs!='complete'&&rs!='loaded')return;clearTimeout(t);try{Typekit.load(TypekitConfig);}catch(e){}};var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(tk,s);})();
</script>
/* Available css classes:
html.wf-loading = While loading you can hide the fonts to avoid FOUT
<script type="text/javascript">
WebtypeConfig = {
kitId: 'd5d59de3-a6b0-4d6a-b7a2-405bead6519b',
scriptTimeout: 3000
};
(function(){var h=document.getElementsByTagName('html')[0];h.className+=' wt-loading';var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wt-loading(\s|$)/g,'');h.className+=' wt-inactive';},WebtypeConfig.scriptTimeout);var wt=document.createElement('link');wt.href='//cloud.webtype.com/css/'+WebtypeConfig.kitId+'.css';wt.type='text/css';wt.rel='stylesheet';wt.async='true';wt.onload=wt.onreadystatechange=function(){var rs=this.readyState;if(rs&&rs!='complete'&&rs!='loaded')return;clearTimeout(t);};var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(wt,s);})();
</script>
@yvesvanbroekhoven
yvesvanbroekhoven / gist:1632270
Created January 18, 2012 10:05
OSX Lion Preview opens your last opened files. This script disables this behaviour.
# Open Terminal and copy following line, followed by the Enter key
defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool false
@yvesvanbroekhoven
yvesvanbroekhoven / grid.scss
Created February 19, 2012 09:23
Sass semantic grid approach
// Defaults which you can freely override
$column-width: 60px;
$gutter-width: 20px;
$columns: 12;
// Utility function — you should never need to modify this
@function gridsystem-width($columns:$columns) {
@return ($column-width * $columns) + ($gutter-width * $columns);
}
@yvesvanbroekhoven
yvesvanbroekhoven / gist:1876871
Created February 21, 2012 14:38
regex <blockquote>

In this string I want to regex all the <blockquote> tags. As match result I want the content of <blockquote>.

<blockquote>
<p>However, it has become increasingly apparent that the relationship fdsqjmreksqjkl mdfsmljkdfsmljkdfs mlkjsqd</p>
</blockquote>
<p>Genetics is a core discipline related to all activities of the LIBD. The genetics project will maintain a state of the art laboratory facility for definitive gene analysis, including genetic and epigenetic analysis in human and animal tissues, and in cell lines, and it will establish deep collaborations with the NIH and with other genetics groups around the world. The genetics core project will be focused on moving genetic association to the clinical level and to guiding the genetic work of the other projects. <blockquote>
<p>However, it has become increasingly apparent that the relationship fdsqjmreksqjkl mdfsmljkdfsmljkdfs mlkjsqd</p>
</blockquote>This will be an end-&shy;&shy; stage functional genetics project, not merely more genotyping and sequ
@yvesvanbroekhoven
yvesvanbroekhoven / jquery-extlink.js
Created February 23, 2012 09:29
Open external links in a new window
@yvesvanbroekhoven
yvesvanbroekhoven / Preferences.sublime-settings
Created July 12, 2012 17:52
My Sublime Text 2 settings
{
"color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme",
// Note that the font_face and font_size are overriden in the platform
// specific settings file, for example, "Preferences (Linux).sublime-settings".
// Because of this, setting them here will have no effect: you must set them
// in your User File Preferences.
"font_face": "Monaco",
"font_size": 12,
html,
body {
padding: 0;
margin: 0;
}
body {
background-color: #eeeeee;
font-family: sans-serif;
}
#wrapper {