Skip to content

Instantly share code, notes, and snippets.

controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) {
$scope.$on('authLoaded', function() {
$scope.isExpert($scope.main.serieId);
$scope.isMember($scope.main.serieId);
});
$scope.loadAuth = function() {
Auth.load().success(function(data) {
$scope.main.user = data.user;
$scope.$broadcast("authLoaded");
t1 = Thread.new do
i = 0
1_000_000.times do
i += 1
end
end
t2 = Thread.new do
j = 0
1_000_000.times do
j += 1
.directive('whenActive',
[
'$location',
($location)->
scope: true,
link: (scope, element, attr)->
scope.$on '$routeChangeSuccess',
() ->
loc = "#"+$location.path()
href = element.attr('href')
Calculate the distance between two coordinates
When we need to measure the distance between two points, we may use one of the following formulas: Haversine formula or Vincenty’s formula. There are two appropriately named functions:
01
function haversineGreatCircleDistance($latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo, $earthRadius = 6371000) {
02
// convert from degrees to radians
03
$latFrom = deg2rad($latitudeFrom);
<html>
<head>
<meta charset="utf-8">
<title>Clean-Markup Line Numbers™</title>
<style>
body {
width: 800px;
margin: 0 auto;
}
$http.post("http://example.appspot.com/rest/app", {"foo":"bar"})
.success(function(data, status, headers, config) {
$scope.data = data;
}).error(function(data, status, headers, config) {
$scope.status = status;
});
$http({
url: "http://example.appspot.com/rest/app",
method: "POST",
data: {"foo":"bar"}
}).success(function(data, status, headers, config) {
$scope.data = data;
}).error(function(data, status, headers, config) {
$scope.status = status;
});
@gmilby
gmilby / 50most frequentlyUsedCommandsLinux.txt
Created November 15, 2013 20:34
50 most frequently used commands in Linux
This article provides practical examples for 50 most frequently used commands in Linux / UNIX.
This is not a comprehensive list by any means, but this should give you a jumpstart on some of the common Linux commands. Bookmark this article for your future reference.
Did I miss any frequently used Linux commands? Leave a comment and let me know.
1. tar command examples
Create a new tar archive.
How To Host Ghost with Nginx on DigitalOcean inShare Write an Article Introduction In April 2013, John O'Nolan, no newcomer to the field of blog-making, launched a Kickstarter for a new kind of blog called Ghost, which could radically simplify writing and maintaining a blog. Here, we'll walk through all of the steps to get Ghost set up and running on a DigitalOcean VPS. Prerequisites Before you get started, there are a few things that you should pull together Obtain a copy of Ghost This tutorial will assume you already have a copy of Ghost on your local computer. Since it's only available to Kickstarter backers right now, you should have been sent a link to the site where you can download it. Set up a VPS This tutorial will assume that you've already set up a VPS. We'll be using Ubuntu 12.04, but you should be fine with whatever you'd like. If you need help with this part, this tutorial will get you started. Point a domain at your VPS This tutorial will assume that you've already pointed a domain