Skip to content

Instantly share code, notes, and snippets.

Anders Svendal anderssvendal

Block or report user

Report or block anderssvendal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@anderssvendal
anderssvendal / README.md
Created Oct 29, 2012
ubuntu + unicorn + sinatra
View README.md
@anderssvendal
anderssvendal / gist:3749134
Created Sep 19, 2012
sublime text settings
View gist:3749134
{
"auto_complete_commit_on_tab": true,
"color_scheme": "Packages/Color Scheme - Default/Spacedust.tmTheme",
"detect_indentation": true,
"draw_white_space": "selection",
"folder_exclude_patterns":
[
".sass-cache",
"tmp"
],
@anderssvendal
anderssvendal / grid.sass
Created Aug 19, 2012
Small sass gridsystem
View grid.sass
// 12 column grid
$column-width: 60px !default
$gutter-width: 20px !default
$grid-columns: 12 !default
$grid-width: $column-width * $grid-columns + $gutter-width * ($grid-columns - 1)
@function column-width($n)
@return $column-width * $n + $gutter-width * ($n - 1)
@anderssvendal
anderssvendal / module.coffee
Created Jul 5, 2012
Easy namespacing of classes and objects.
View module.coffee
# Easy namespacing of classes and objects.
#
# name - The String containing namespaces up to but not including the class
# name.
#
# Examples
# # Using a class
# class module("Foo.Bar").Baz
# doStuff: ->
# console.log "doing stuff"
@anderssvendal
anderssvendal / keyboard.m
Created Jul 5, 2012
adjust for keyboard
View keyboard.m
- (void)adjustViewForTextField:(UITextField*)textField animated:(BOOL)animated {
CGRect frame = self.view.frame;
double screenSize = 480.0;
double topHeight = 20.0;
double keyboardSize = 216.0;
double keyboardPos = screenSize - keyboardSize;
double textFieldPos = topHeight + textField.frame.origin.y;
double textFieldHeight = textField.frame.size.height;
double textFieldBottom = textFieldPos + textFieldHeight;
@anderssvendal
anderssvendal / price.coffee
Created Jul 4, 2012
CoffeeScript price formatter
View price.coffee
formatPrice = (price)->
return '0' if isNaN(price)
price = price + ''
price = price.split(/\./)
decimals = price[1]
price = price[0]
iterations = price.length / 3
i = price.length
segments = []
@anderssvendal
anderssvendal / sass.rb
Created Jun 11, 2012
Simple retina backgrounds with sass
View sass.rb
require 'sass_extensions'
@anderssvendal
anderssvendal / Procfile
Created May 3, 2012
Foreman nginx, php, mysql setup
View Procfile
web: /usr/local/sbin/nginx -p `pwd`/tmp/nginx/ -c ../../nginx.conf
fastcgi: /usr/local/sbin/php-fpm
db: /usr/local/bin/mysqld
View tooltip.css
/* line 3, tooltip.css.sass */
.tooltip {
margin-top: 5px;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
position: absolute;
padding: 7px 0 14px;
}
/* line 10, tooltip.css.sass */
.tooltip i {
View time_formatter.coffee
TimeFormatter =
to_pretty: (date)->
now = new Date()
date = new Date(date)
# Time ago in seconds
a = (now - date) / 1000
if a is 0 then 'akkurat nå'
else if a is 1 then 'ett sekund siden'
You can’t perform that action at this time.