Skip to content

Instantly share code, notes, and snippets.

{
"name": "miljokalkulator",
"version": "0.0.1",
"dependencies": {"nsb-assets": "git@github.com:nsb-frontend/nsb-assets.git"}
}
@geirarne
geirarne / pre-commit
Created November 20, 2013 10:37
Currect pre-commit hook. Based on the sample provided by git, and added a check for console.log|warn|etc.
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
@geirarne
geirarne / disabled-placeholder
Created September 19, 2013 14:23
New adventures in iOS input field styling, specifically disabled fields and placeholder text. Thanks to @fatso83 and http://blog.iamvdo.me/post/42510603205/styler-les-input-inactifs-disabled-sur-ios-iphone
<!DOCTYPE html>
<html>
<head>
<title>Placeholder & Disabled</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<style>
label {
display: block;
}
input {
@geirarne
geirarne / _sprites.sass
Created December 10, 2012 13:44
sprites mixin
@mixin dimensions($width,$height)
width: $width
height: $height
@mixin sprite($x_offset,$y_offset)
background: image_url('sprites.png') no-repeat $x_offset $y_offset
@mixin spriteblock($width,$height,$bg_x_offset,$bg_y_offset)
display: block
text-indent: -9999px
@geirarne
geirarne / conditional_html.html.haml
Created November 13, 2012 14:22
use this as a helper method.
def conditional_html(options={}, &blk)
attrs = options.map { |(k, v)| " #{h k}=\"#{h v}\"" }.join('')
[ "<!--[if lt IE 7 ]> <html#{attrs} class=\"ie6 no-js oldie\"> <![endif]-->",
"<!--[if IEMobile 7 ]> <html#{attrs} class=\"iemob7 no-js oldie\"> <![endif]-->",
"<!--[if (IE 7) & !(IEMobile 7) ]> <html#{attrs} class=\"ie7 no-js oldie\"> <![endif]-->",
"<!--[if IE 8 ]> <html#{attrs} class=\"ie8 no-js oldie\"> <![endif]-->",
"<!--[if IE 9 ]> <html#{attrs} class=\"ie9 no-js oldie\"> <![endif]-->",
"<!--[if (gt IE 9)|!(IE)]><!--> <html#{attrs} class=\"no-js\"> <!--<![endif]-->",
capture_haml(&blk).strip,
"</html>"
@geirarne
geirarne / recreate.rb
Created October 8, 2012 13:52
recreate images on krohnark.no
Subarticle.all.each do |article|
article.images.each do |image|
image.image.recreate_versions!
end
end
Article.all.each do |article|
article.images.each do |image|
image.image.recreate_versions!
end
@geirarne
geirarne / httpd.conf
Created September 19, 2012 07:12
https-vhosts.conf
Listen 9000
NameVirtualHost *:9000
<VirtualHost *:9000>
#ZDS Name: visuelt
DocumentRoot "/Users/geirarne/Code/visuelt/www"
ErrorLog error.log
<Directory "/Users/geirarne/Code/visuelt/www">
AllowOverride All
Options Indexes FollowSymLinks
Order allow,deny
@geirarne
geirarne / _logo.html.haml
Created August 28, 2012 11:19
svg logo changing on mouseover, as seen on http://salty-taiga-4319.herokuapp.com/
%svg#logo{:height => "173", :version => "1.1", :width => "222", :xmlns => "http://www.w3.org/2000/svg"}
%g#layer1{:transform => "translate(0,-879.36218)"}
%g#g3325{"clip-path" => "url(#clipPath3327)", :transform => "matrix(1.25,0,0,-1.25,-65.45499,1103.171)"}
%g#logo-topleft{:transform => "translate(53.4551,178.2993)"}
%path#logo-topleft-line{:d => "M 0,0 44,-34", :style => "fill:none;stroke:#000000;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1"}/
%g#logo-topright{:transform => "translate(229.3887,178.2993)"}
%path#logo-topright-line{:d => "M 0,0 -44,-34", :style => "fill:none;stroke:#000000;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-opacity:1"}/
%g#logo-bottomleft{:transform => "translate(100,75)"}
%path#logo-bottomleft-line{:d => "M 0,0 -44,-34", :style => "fill:none;stroke:#231f20;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;
@geirarne
geirarne / gist:3003965
Created June 27, 2012 13:07
profile.bash
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/Users/geirarne/bin:/Applications/Lynxlet.app/Contents/Resources/lynx/bin:/php/includes:/usr/lib/php/pear:$PATH"
export PATH=$PATH:/opt/node/bin
export PATH=$PATH:~/bin/jsl-0.3.0-mac/
export EDITOR="$HOME/bin/subl -w"
export HISTIGNORE="&:ls:[bf]g:exit"
alias ls='ls -G'
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
@geirarne
geirarne / gist:2994077
Created June 26, 2012 07:25
form builder
def image_upload(attribute, options={})
control_group do
label(attribute, class: 'control-label')+
controls do
if(defined?object[attribute] && !object[attribute].blank?)
# ::TODO:: make this into a real variable!!! (use attribute instead of the hard-coded 'background_image')
@template.image_tag(object.background_image.url(:thumb))
end+
tag('br')+
file_field(attribute)+