Skip to content

Instantly share code, notes, and snippets.

View Infernosquad's full-sized avatar
🏠
Working from home

Artem Zhuravlev Infernosquad

🏠
Working from home
View GitHub Profile
@Infernosquad
Infernosquad / compose.yml
Created July 31, 2022 15:47 — forked from Nielio/compose.yml
Gitlab CE with build in Container Registry behind Traefik 2 with Letsencrypt
version: "3.6"
services:
gitlab:
image: gitlab/gitlab-ce
volumes:
- gitlab-data:/var/opt/gitlab
- gitlab-logs:/var/log/gitlab
- gitlab-config:/etc/gitlab
networks:
- traefik-public
@Infernosquad
Infernosquad / AngularJS-Cachebusting.js
Created June 14, 2016 09:59 — forked from ProLoser/AngularJS-Cachebusting.js
Elegant cache-busting for AngularJS HTML assets
anglar.module('myApp',['ui']).config(["$provide", function($provide) {
return $provide.decorator("$http", ["$delegate", function($delegate) {
var get = $delegate.get;
$delegate.get = function(url, config) {
// Check is to avoid breaking AngularUI ui-bootstrap-tpls.js: "template/accordion/accordion-group.html"
if (!~url.indexOf('template/')) {
// Append ?v=[cacheBustVersion] to url
url += (url.indexOf("?") === -1 ? "?" : "&");
url += "v=" + cacheBustVersion;
}
@Infernosquad
Infernosquad / Post.php
Created May 18, 2016 02:32
Many to Many Query
<?php
namespace ContentBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
@Infernosquad
Infernosquad / 1-Explanations.md
Created April 20, 2016 18:06 — forked from danvbe/1-Explanations.md
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@Infernosquad
Infernosquad / commands.sh
Created February 26, 2016 11:55
restore Upwork on Ubuntu 14.04
# Problem package: https://launchpad.net/ubuntu/+source/nss
# Repository of package releases: http://security.ubuntu.com/ubuntu/pool/main/n/nss
#
# NOTE: This recipe tested only for ubuntu 14.04 32 bit
# Open ubuntu terminal, copy and paste and run commands below
# Check your ubuntu version
lsb_release -a
# Download old version of nss libraries
@Infernosquad
Infernosquad / README.md
Created February 12, 2016 17:41 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@Infernosquad
Infernosquad / User.php
Last active August 29, 2015 14:25 — forked from Ocramius/User.php
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
<?php
namespace Chyrius\PublicBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\HttpFoundation\Request;
use Chyrius\PublicBundle\Menu\RequestVoter;
use Symfony\Component\DependencyInjection\ContainerInterface;
class MenuBuilder
# Deployment server info
set :application, "APP NAME"
set :domain, "APP DOMAIN NAME"
set :deploy_to, "/path/on/live/server"
set :app_path, "app"
set :web_path, "web"
set :maintenance_basename, "maintenance"
# SCM info
set :repository, "GIT REMOTE REPO URL"
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.