Skip to content

Instantly share code, notes, and snippets.

@corkupine
corkupine / controllers.js
Created August 14, 2012 17:52
Controller that makes use of angular-auth
var mod = {};
mod.AuthCtrl = [
'$scope', 'requests401', '$http', 'Ping', '$location', function($scope, requests401, $http, Ping, $location) {
var fadespeed = 300;
$scope.user = {
"username": "test",
"password": "test"
};
@corkupine
corkupine / angular-auth.js
Created August 23, 2012 17:40 — forked from witoldsz/angular-auth.js
Angular Auth (work-in-progress)
/**
* @license Angular Auth
* (c) 2012 Witold Szczerba
* License: MIT
*/
angular.module('angular-auth', [])
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in the future, once login is completed.
@corkupine
corkupine / gist:3450627
Created August 24, 2012 13:41
angular-lawnchair-services-async
mod = angular.module('vendorPortal.services', ['ngResource']);
mod.factory('UserData', ($resource,$location) ->
resource = $resource('http://' + $location.host() + '/Services/userinfo')
return () ->
resource.get()
)
.factory('UserDataStore', ($resource, $location, UserData, $q, $rootScope) ->
mystore = new Lawnchair('userdata', () -> {})
GetUserDataFromXhr = () ->
xhrDeferred = $q.defer()
@corkupine
corkupine / userdatacaching.coffee
Created August 24, 2012 22:04
Fixed caching UserDataService
mod = angular.module('myApp.services', ['ngResource']);
mod.factory('UserData', ($resource,$location) ->
return $resource('http://' + $location.host() + '/Services/userinfo')
)
.factory('UserDataStore', ($resource, $location, UserData, $q, $rootScope) ->
GetUserDataFromXhr = () ->
deferred = $q.defer()
UserData.get((userdata) ->
deferred.resolve userdata.userInfo
@corkupine
corkupine / README.md
Created September 13, 2012 14:45 — forked from jcreamer898/README.md
Using amplifyjs as with RequireJS 2.0

Using AmplifyJS with RequireJS 2.0

With the lastest version of Require, a new config object was introduced, the shim.

http://requirejs.org/docs/api.html#config-shim

That allows Amplify to now be used within AMD projects.

Have Fun!

@corkupine
corkupine / ioc.cs
Created October 3, 2012 18:39
wiring up new dependencies
container.Register<IndexedCompanyRepository>(c => new IndexedCompanyRepository(new RiakCompanyRepository(container.Resolve<IRiakClient>()),
container.Resolve<IElasticClient>())).ReusedWithin(ReuseScope.Request);
container.Register<ICompanyRepository>(c => container.Resolve<IndexedCompanyRepository>());
container.Register<IFindCompanies>(c => container.Resolve<IndexedCompanyRepository>());
@corkupine
corkupine / indexcreation.cs
Created October 12, 2012 21:36
index creation
public class IndexedRepo
{
private IClient _client;
private static bool _indexCreated;
private static readonly object _locker = new object();
public IndexedRepo(IClient client)
{
this._client = client;
lock(_locker)
@corkupine
corkupine / apseduo.cs
Created October 16, 2012 18:47
AuditingPersistence pseudocode
public ObjRepository : IObjRepository
{
public Obj Add(Obj newObj)
{
Audited<Obj> newAuditedObj = new AuditPersist.Audited<Obj>(Obj newObj);
Audited<Obj> persistedAuditedObj = CI.Add<Audited<Obj>>("objbucket", newAuditedObj);
return newAuditedObj.CurrentState();
}
private Audited<Obj> GetAudited(Guid objId)
"devDependencies": {
"bower": "~0.6.4",
"underscore" : "~1.4.4",
"grunt" : "0.4.0rc4",
"grunt-cli" : "~0.1.5",
"grunt-contrib-clean" : "~0.4.0a",
"grunt-contrib-coffee" : "git+https://github.com/gruntjs/grunt-contrib-coffee.git#01f90adb16e315ee88c0befa5bb401bbfd4cbc6e",
"grunt-contrib-concat" : "~0.1.1",
"grunt-contrib-connect" : "0.1.0",
"grunt-contrib-copy" : "git+https://github.com/gruntjs/grunt-contrib-copy.git#2bd6f0e99e6be6f4bc48f50e5cb32ff8aa3f8ffc",
@corkupine
corkupine / tf-import-stack.sh
Created October 31, 2022 18:39 — forked from jmlrt/tf-import-stack.sh
import terraform stack resources helper
#!/usr/bin/env bash
# List terraform resources in the current directory and ask their arn to import them into terraform state
RESOURCES_LIST=$(awk -F\" '/^resource "/ {print $2"."$4}' *.tf)
for resource in ${RESOURCES_LIST}
do
read -p "Enter ARN for resource ${resource} (type none to not import it): " arn
if [[ ${arn} != "none" ]]