Skip to content

Instantly share code, notes, and snippets.

View kfuchs's full-sized avatar

Kirill Fuchs kfuchs

View GitHub Profile
@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: ['*']
@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 / 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>
/**
* Dvd
*
* @ORM\Table(name="dvd")
* @ORM\Entity
*/
class Dvd
{
/**
* @var integer
@kfuchs
kfuchs / MyQueueServiceProvider.php
Created September 23, 2015 12:01 — forked from SammyK/MyQueueServiceProvider.php
AWS SQS Push Queues for Laravel 4.1
<?php namespace App\LaravelExtensions;
use Illuminate\Queue\QueueServiceProvider;
class MyQueueServiceProvider extends QueueServiceProvider {
/**
* Register the connectors on the queue manager.
*
* @param \Illuminate\Queue\QueueManager $manager
@kfuchs
kfuchs / idea
Created November 14, 2015 15:40 — forked from chrisdarroch/idea
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
.
├── actions
├── stores
├── views
│   ├── Anonymous
│   │   ├── __tests__
│   │   ├── views
│   │   │   ├── Home
│   │   │   │   ├── __tests__
│   │   │   │   └── Handler.js
#!/bin/bash -xv
# Initialize Amazon Linux AMI 2015.09 for PHP7 Web Application
# yum
# update default
sudo yum upgrade --enablerepo="*" -y
# install php
for i in $(seq 3)
do
[ ! -s remi-release-6.rpm ] && curl --connect-timeout 3 http://remi.kazukioishi.net/enterprise/remi-release-6.rpm > remi-release-6.rpm
@kfuchs
kfuchs / nginx.default.conf
Created April 22, 2016 23:53 — forked from sumardi/nginx.default.conf
Install PHP-FPM, Nginx & MySQL on EC2 with Amazon Linux AMI
# Install linux update, followed by GCC and Make
sudo yum -y update
sudo yum install -y gcc make
# Install Nginx and PHP-FPM
sudo yum install -y nginx php-fpm
# Install PHP extensions
sudo yum install -y php-devel php-mysql php-pdo \
php-pear php-mbstring php-cli php-odbc \
@kfuchs
kfuchs / ec2-host-from-tag-to-env-vars.sh
Created June 17, 2016 16:02 — forked from marcellodesales/ec2-host-from-tag-to-env-vars.sh
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User