Skip to content

Instantly share code, notes, and snippets.

@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 / 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; }
}
<!doctype html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="jquery.parseParams.js"></script>
</head>
<body>
<script>
@Darep
Darep / _breakpoints.scss
Created January 27, 2013 10:45
Copy-paste breakpoints.scss from an enterprise project
// Breakpoints
$breakpoint-1: 320px;
$breakpoint-2: 601px;
$breakpoint-3: 801px; // Desktop min-width. Stuff starts to look like it's in the PSDs
$breakpoint-4: 1000px; // Typical desktop min-width
$breakpoint-5: 1201px; // Maximum width. Nothing should be happening beyond this point
$breakpoint-1-max-width: 460px;
$breakpoint-2-max-width: 580px;
$breakpoint-3-max-width: 999px;
$breakpoint-4-max-width: 1200px;
@Darep
Darep / application.adapter.js
Last active November 10, 2015 09:24
ember-data ok
import Ember from 'ember';
export default DS.ActiveModelAdapter.extend({
host: 'https://output.jsbin.com',
namespace: 'zufarix',
buildURL: function (modelName, id, snapshot, requestType, query) {
var url = this._super(modelName, id, snapshot, requestType, query);
url = url.replace('colors/', '') + '.json';
return url;