Skip to content

Instantly share code, notes, and snippets.

View GavukaAlexandr's full-sized avatar

Oleksandr GavukaAlexandr

View GitHub Profile
@GavukaAlexandr
GavukaAlexandr / gist:0b89739a400f4506e516a24e80ba9000
Created January 3, 2017 20:22
DoctrineFixtureBundle + Faker
<?php
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Lv\LibraryBundle\Entity\Customer;
use Lv\LibraryBundle\Entity\CustomerBooks;
use Faker;
class CustomerWithCustomerBooksFixture extends AbstractFixture implements OrderedFixtureInterface
{
@GavukaAlexandr
GavukaAlexandr / 1-Explanations.md
Created January 11, 2017 13:16 — 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.
@GavukaAlexandr
GavukaAlexandr / controllers.js
Last active September 29, 2017 19:01
AngularJs Service
angular.module('starter.controllers', [])
.factory('userData', function ($http, $q) {
var userId;
return {
set: function (data) {
userId = data;
},
get: function () {
var deferred = $q.defer();
@GavukaAlexandr
GavukaAlexandr / launch.json
Created December 8, 2017 00:42
VS Code debug config for NodeJs with Babel
// can be used with
// https://github.com/MakingSense/mern-seed
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch via Babel",
"program": "${workspaceRoot}/api/server.js",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node",
@GavukaAlexandr
GavukaAlexandr / LetsEncrypt.md
Created January 27, 2018 21:50 — forked from davestevens/LetsEncrypt.md
Let’s Encrypt setup for Apache, NGINX & Node.js

Let's Encrypt

Examples of getting certificates from Let's Encrypt working on Apache, NGINX and Node.js servers.

Obtain certificates

I chose to use the manual method, you have to make a file available to verify you own the domain. Follow the commands from running

git clone https://github.com/letsencrypt/letsencrypt
cd letsencrypt
#include <stdio.h>
#define NUMBER_OF_DIGITS 16 /* space for NUMBER_OF_DIGITS + '\0' */
void uitoa(unsigned int value, char* string, int radix)
{
unsigned char index, i;
index = NUMBER_OF_DIGITS;
i = 0;
@GavukaAlexandr
GavukaAlexandr / main.c
Last active August 2, 2018 12:08
C stack example with strings
#include <stdio.h>
#include <string.h>
int MAXSIZE = 8;
char stack[8][5];
int top = -1;
int isempty() {
if(top == -1)
@GavukaAlexandr
GavukaAlexandr / readme.md
Created November 14, 2021 20:52 — forked from ChriRas/readme.md
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks
@GavukaAlexandr
GavukaAlexandr / language_switch.ahk
Created December 31, 2023 14:36 — forked from userhooke/language_switch.ahk
AHK > Switch input language by pressing CapsLock
; Path to startup folder Windows 10 = C:\Users\${user.name}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetCapsLockState, AlwaysOff
CapsLock::Send, {Alt Down}{Shift Down}{Shift Up}{Alt Up}