Skip to content

Instantly share code, notes, and snippets.

@Darep
Darep / blog.html.erb
Created January 5, 2014 19:20
Old-school numbered pagination for middleman-blog – see http://i.imgur.com/oYa0Cfj.png
<% if paginate && num_pages > 1 %>
<div class="pagination">
<% if prev_page %>
<%= link_to '<i class="icon-arrow-left"></i> Prev', prev_page, class: 'prev page-numbers' %>
<% else %>
<span class="disabled"><i class="icon-arrow-left"></i> Prev</span>
<% end %>
<% for p in 1..num_pages %>
<% if p == page_number %>
@Darep
Darep / rollbar.js
Last active December 21, 2015 22:29
Use Rollbar (https://rollbar.com/) with Browserify
// Download rollbar.js and rollbar.min.js from:
// http://d37gvrvc0wt4s1.cloudfront.net/js/1/rollbar.js
// http://d37gvrvc0wt4s1.cloudfront.net/js/1/rollbar.min.js
//
// Place them into vendor/ and this code into lib/rollbar.js, or something
(function(w, d) {
w._rollbarParams = {
"server.environment": "production",
"notifier.snippet_version": "2"
@Darep
Darep / songs.clj
Created August 28, 2013 19:55
Clojure problem
(ns beatstream.songs
(:require clojure.java.io)
(:import [org.jaudiotagger.audio AudioFileIO]
[org.jaudiotagger.tag FieldKey]))
(def music-path "/Users/ajk/Music/")
(defn get-song-files [directory]
(->> directory
clojure.java.io/file
@Darep
Darep / fi.yml
Last active December 21, 2015 18:49 — forked from soffes/en.yml
Finnish translations for Roon.
fi:
viewer:
comment_on_twitter: 'Kommentoi Twitterissä'
older: 'Vanhemmat'
newer: 'Uudemmat'
feed: 'Syöte'
share: 'Jaa'
close: 'Sulje'
next_post: 'Seuraava artikkeli'
previous_post: 'Edellinen artikkeli'
@Darep
Darep / _em.scss
Created July 11, 2013 21:05
My favorite Sass function <3
// Converts pixels to EMs
// Usage: em(16) em(16px) em(16, 24) em(16px, 24px) em(16px, 1em)
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
@function em($pixels, $context: 16) {
$base: 16;
$value: strip-units($pixels);
$value_unit: unit($pixels);
@Darep
Darep / ember.sh
Created May 22, 2013 09:26
Use this simple script to easily create a new, clean Ember.JS project. I use this to create small, simple experiments. It's a bit like "rails new" :) Usage: ember new project-name
#!/bin/bash
#
# ember - Ember.JS starter kit script
# Download this and place it into e.g. /usr/local/bin
#
# Original: https://github.com/Darep/dotfiles/blob/master/bin/ember
#
[ -z "$1" ] && echo "No argument supplied" && exit
@Darep
Darep / Rakefile
Last active January 27, 2018 22:39
Super simple Middleman deploy script, uses Rsync over SSH or plain SCP
SSH_USER = 'test'
SSH_HOST = 'example.com'
SSH_DIR = '/home/test/website/releases'
RSYNC = false
desc "Run the preview server at http://localhost:4567"
task :preview do
system("middleman server")
end
@Darep
Darep / someModule.js
Last active December 14, 2015 18:19
buildData: function () {
var newData, data = api.getSongs();
// Fix paths
var transformPath = this.transformPath.bind(this);
newData = data.map(function (row) {
row.path = transformSongPath(row.path);
return row;
});
<!-- source/layouts/layout.html.erb -->
<ul class="nav-float products">
<% for cat in data.products.main_categories do %>
<li>
<h4>
<% link_to cat.url do %>
<%= cat.name %>
<% end %>
</h4>
<ul>
@Darep
Darep / _breakpoints.scss
Last active December 13, 2015 16:48
_breakpoints.scss from a small project with support for old IE. This requires that when declaring the media-queries, you declare them from smallest to widest. Note: mixin can only be used inside a CSS declaration block.
// Breakpoints for responsive design ($cols are from Frameless Grid)
$breakpoint-1: $cols5;
$breakpoint-2: $cols7;
$breakpoint-3: $cols9;
@mixin breakpoint($point) {
@if $point == wide {
@media (min-width: $breakpoint-3) { @content; }
.oldie & { @content; }
}