Skip to content

Instantly share code, notes, and snippets.

View MikSDigital's full-sized avatar
🎯
Focusing

Mikhail MikSDigital

🎯
Focusing
View GitHub Profile
@MikSDigital
MikSDigital / PostMessageToSlackChannel.php
Created November 27, 2018 16:32 — forked from nadar/PostMessageToSlackChannel.php
Post a message to a slack channel with PHP
<?php
/**
* Send a Message to a Slack Channel.
*
* In order to get the API Token visit: https://api.slack.com/custom-integrations/legacy-tokens
* The token will look something like this `xoxo-2100000415-0000000000-0000000000-ab1ab1`.
*
* @param string $message The message to post into a channel.
* @param string $channel The name of the channel prefixed with #, example #foobar
@MikSDigital
MikSDigital / .htaccess
Created October 28, 2018 16:23 — forked from Guibzs/.htaccess
Symfony 4 .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /index.php/
@MikSDigital
MikSDigital / vp.sh
Created September 22, 2018 09:24
setup VPN
sudo apt-get install network-manager-openvpn-gnome
sudo apt-get install network-manager-openconnect-gnome
sudo apt-get install openconnect netowrk-manager-openconnect-gnome
@MikSDigital
MikSDigital / webinars.py
Created September 20, 2018 14:08
webinars creation via API
import requests
import json
url = "https://api.getgo.com/G2W/rest/v2/organizers/000000000000/webinars"
payload = {
"subject": "test888test",
"description": " - ",
"times": [
{
@MikSDigital
MikSDigital / MenuBuilder.php
Created September 5, 2018 18:03
Custom KnpMenuBundle navigation bar twig template to support Font Awesome icons & Twitter bootstrap lay-out
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@MikSDigital
MikSDigital / Menu.php
Created August 31, 2018 17:13 — forked from lsv/Menu.php
Symfony 4 - KnpMenuBundle - menu with event
<?php
// src/Menu/Menu.php
namespace App\Menu;
use App\Event\Menu\Topbar\UserMenuEvent;
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RequestStack;
@MikSDigital
MikSDigital / guzzle.php
Created August 25, 2018 09:46 — forked from tomykaira/guzzle.php
Set user-agent in guzzle. client->setDefaultOption('headers/User-Agent', 'foo'); does not work for user-agent.
<?php
require 'vendor/autoload.php';
use Guzzle\Service\Client;
// Create a client with a base URL
$client = new Client('http://requestb.in/1ivmkhd1');
$client->setUserAgent('myuseragent');
// Send a request to https://github.com/notifications
$response = $client->get('')->send();
@MikSDigital
MikSDigital / MenuBuilder.php
Created August 5, 2018 13:54 — forked from nateevans/MenuBuilder.php
KNP Menu Bundle with Bootstrap 3 and Font Awesome 4 (see http://bit.ly/1sd1rJr , thanks to Niels Mouthaan!)
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@MikSDigital
MikSDigital / User.php
Created July 6, 2018 18:31 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@MikSDigital
MikSDigital / fizzbuzz.js
Created June 15, 2018 06:45
js implementation of fizzBuzz algorythm
/*Create a for loop that will iterate through 100 numbers starting from 1 and do the following:
if the number is a multiple of 3, it will console.log "fizz",
if the number is a multiple of 5, it will console.log "buzz",
if the number is a multiple of 3 and 5, it will console.log "fizzBuzz"
*/
function fizzBuzz(num) {
for (var i = 1; i <= num; i++) {
if (i % 15 === 0) console.log('FizzBuzz');
else if (i % 3 === 0) console.log('Fizz');