Skip to content

Instantly share code, notes, and snippets.

View alex-ross's full-sized avatar

Alexander Ross alex-ross

View GitHub Profile
# Converts exported json data to GH markdown pages for webbradion.net
# Must be runned from projects root directory and expects an file called 'e.json' to exists.
# e.json should be an JSON export of Episodes from Webbradions database.
require 'json'
require 'ostruct'
def content(e)
<<-EOF
---
@alex-ross
alex-ross / unit.js
Last active December 30, 2015 15:49
Example of unit.js file for karma in rails applications. This should allow tests to be written in both coffescript or javascript
/**
* Karma configuration
*
* Enables tests to be written in both javascript and coffeescript.
*
* Run your tests with: `karma start spec/karma/config/unit.js`
*
* Place your tests in similar paths: `spec/javascripts/<anydir>/<file>_spec.coffee`
* This file should be in: `spec/karma/config/unit.js`
*
/**
* Redirect unauthorized users to given path
* whenever any response returns http code 401.
*/
angular.module('RedirectUnauthorized')
.config(['$httpProvider', function($httpProvider) {
// Where should we redirect unauthorized users?
var loginPath = '/signin';
angular.module('LoadingIndicator', [])
.config(['$httpProvider', function ($httpProvider) {
var startLoadingIndicator = function() {
angular.element('.loading').text('Loading ...');
};
$httpProvider.responseInterceptors.push('HttpLoadingInterceptor');
$httpProvider.defaults.transformRequest.push(function (data, headersGetter) {
// On request start
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600,700,900' rel='stylesheet' type='text/css'>
<style>
.icon-file-alt {
@alex-ross
alex-ross / Preferences.sublime-settings
Last active December 10, 2015 18:08
My sublime settings-file
{
"auto_find_in_selection": true,
"bold_folder_labels": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"fold_buttons": true,
"folder_exclude_patterns":
[
".svn",
@alex-ross
alex-ross / assets_helper.php
Last active October 13, 2015 15:48
Thin assets helper class for php. Made it just for fun but may come useful for realy small projects.
<?php
/**
* @author Alexander Ross <alex@aross.se>
* @license MIT
*/
class AssetsHelper
{
private $js_array = [];
private $css_array = [];