This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace MyApp\Response; | |
use Cookie; | |
use Request; | |
use Session; | |
use Symfony\Component\HttpFoundation\Cookie as SymfonyCookie; | |
trait AngularTrait { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cryptojs = require('crypto') | |
, salt = "<client app salt token>" | |
, keyIterations = 1000 //number of interations to generate your key | |
, keyLength | |
, key | |
, password | |
, cipher | |
, msg = "<what you want to encrypt>" | |
, encryptedMsg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var $injector = angular.injector(['ng']); | |
$injector.invoke(function($http) { | |
// this works! | |
$http.get("/auth/csrf_token").then(function(response) { | |
angular.module("app").constant("CSRF_TOKEN", response.csrf_token); | |
angular.bootstrap(document, ['app']); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod | |
May contain errors where latitude and longitude are off. Use at own non-validated risk. | |
*/ | |
SET NAMES utf8; | |
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; | |
DROP TABLE IF EXISTS postcodes_geo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto') | |
, key = 'salt_from_the_user_document' | |
, plaintext = 'password' | |
, cipher = crypto.createCipher('aes-256-cbc', key) | |
, decipher = crypto.createDecipher('aes-256-cbc', key); | |
cipher.update(plaintext, 'utf8', 'base64'); | |
var encryptedPassword = cipher.final('base64') | |
decipher.update(encryptedPassword, 'base64', 'utf8'); |