Skip to content

Instantly share code, notes, and snippets.

View alexcrown's full-sized avatar

Alex Crown alexcrown

  • Colvir Software Solutions
  • Moscow, Russia
View GitHub Profile
@alexcrown
alexcrown / gist:38ac3baf40dc1cc73885
Last active August 29, 2015 14:08
Requirejs + hashres + Grunt
// I found solution for hashres in requireJs module. It based on method onModuleBundleComplete which invoked for each bundle after it created.
// Methods for calc hash used from grunt-task-hashres.
requirejs: {
compile: {
options: {
...
onModuleBundleComplete: function (data) {
var crypto = require('crypto'),
fs = require('fs');
var utils = require("./node_modules/grunt-hashres/tasks/hashresUtils");
@alexcrown
alexcrown / gist:089971889fda0ca4e7b1
Created October 21, 2014 15:42
Jasig CAS auth in angular webapp
$scope.login = function () {
$http({ // getting TGT (Ticket Granting Ticket)
method: 'POST',
url: 'http://localhost/cas/v1/tickets',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $.param({username: $scope.loginform.username, password: $scope.loginform.password})
}).success(function(data, status, headers) {
// CAS returns location where we can request service ticket
var location = headers('Location');
$http({ //requesting service ticket, rest/app/heartbeat is part of our app