Skip to content

Instantly share code, notes, and snippets.

View kfuchs's full-sized avatar

Kirill Fuchs kfuchs

View GitHub Profile
@kfuchs
kfuchs / add-photo.html
Last active August 29, 2015 14:01
Directive
<div class="row" ng-file-drop>
<div class="col-md-6 col-lg-6">
<h3>Select files</h3>
<div ng-show="uploader.isHTML5">
<!-- Example: ng-file-drop | ng-file-drop="options" -->
<div class="marketing img-drop-zone" ng-file-drop="{ url: '/foo' }" ng-file-over="img-hover">
<span class="icon ion-image icon-bg"></span>
@kfuchs
kfuchs / gist:f8a4aa48c8e7c8dc103e
Created May 1, 2014 15:28
Interceptor Example
App.config(function($httpProvider) {
var logsOutUserOn401 = function($location, $q, SessionService) {
var success = function(response) {
return response;
};
var error = function(response) {
if(response.status === 401) {
SessionService.unset('authenticated');
$location.path('/login');
@kfuchs
kfuchs / gist:9389692
Created March 6, 2014 13:29
Settings for NelmioCORSBundle that ended hours of misery
# app/config/config.yml
# The part that saved me was:
# 1: My quotes didn't wrap every header type in allow_headers
# 2: hosts: has to be set to the domain making the request.
nelmio_cors:
defaults:
allow_credentials: true
allow_origin: ['*']