Skip to content

Instantly share code, notes, and snippets.

View aldavigdis's full-sized avatar

Alda Vigdis Skarphedinsdottir aldavigdis

View GitHub Profile
@aldavigdis
aldavigdis / gist:a52bc9edb7cedfcc0f75
Created July 16, 2015 08:14
Connecting with a remote server via XHR and handling connection errors
function authenticate(callback, error) {
resetErrors();
angular.element('#login-form input[type=submit]').button('loading');
$scope.authRequest = new XMLHttpRequest();
$scope.authRequest.open('GET', 'http://lfo-prtg:81/odata/', true, 'UNRWA\\' + $scope.username, $scope.password);
$scope.authRequest.send();
$scope.connectionTimer = $interval(function () {
$scope.authRequest.abort();
@aldavigdis
aldavigdis / backup.daily.rb
Last active August 29, 2015 14:23
Daily backup from a Rails application
#! /usr/bin/env ruby -w
# Include the YAML library
require 'yaml'
# Get the current Rails environment. Falls back on 'production'
backup_env = (ENV['RAILS_ENV'] || 'production')
# Set the backup location
backup_location = ARGV[0] || '.'