Skip to content

Instantly share code, notes, and snippets.

View Tobur's full-sized avatar

Alexandr Sharamko Tobur

  • Kharkov
View GitHub Profile
$likesCategory = array(
"1103" => "Actor/Director",
"1105" => "Movie",
"1108" => "Producer",
"1109" => "Writer",
"1110" => "Studio",
"1111" => "Movie Theater",
"1112" => "TV/Movie Award",
"1113" => "Fictional Character",
"1200" => "Album",
<?php
//insert into php.ini
//sendmail_path = "/usr/local/bin/php /localetc/sendmail_stub/fake.php"
$sendMailStubObj = new SendMailStub();
$sendMailStubObj->main();
class SendMailStub
{
private $_saveEmailsPath = "/home/tobur/mail/";
<?php
namespace Widop\Mink\Extension;
/**
* Dictionary to manage popups.
*
* @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
*/
trait PopupDictionary
@Tobur
Tobur / gist:6991478
Last active December 25, 2015 14:29
protected function execute($link, $parameters = array(), $method = "GET", $headers = array(), $accessToken = null)
{
$parametersString = '';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $link);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
if ($accessToken) {
$headers[] = 'Authorization: Bearer '.$accessToken;
}
/**
*
* @param Request $request
* @param AuthenticationException $exception
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
{
$data = $request->request->All('_username');
$username = $data['_username'];
private function onFailure(GetResponseEvent $event, Request $request, AuthenticationException $failed)
{
if (null !== $this->logger) {
$this->logger->info(sprintf('Authentication request failed: %s', $failed->getMessage()));
}
$token = $this->securityContext->getToken();
if ($token instanceof UsernamePasswordToken && $this->providerKey === $token->getProviderKey()) {
$this->securityContext->setToken(null);
}
var geocoder = new google.maps.Geocoder();
geocoder.geocode({"address":$('#'+settings.findInputId).val()}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var lat = results[0].geometry.location.lat(),
lng = results[0].geometry.location.lng(),
placeName = results[0].address_components[0].long_name,
latlng = new google.maps.LatLng(lat, lng);
marker.setPosition(latlng);
infowindow.setContent(placeName);
<?php
/**
*
* @Service("core.event_listener.kernel")
*
* @Tag("kernel.event_listener", attributes = { "event" = "kernel.request", "method" = "processApi" })
*/
class Kernel
{
$ git branch -r --merged |
awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' |
xargs git push origin --delete
<?php
/**
* @return DateTime
*/
function getNextPaymentDate(DateTime $lastPaymentDate = null)
{
// 1. Get start date
$day = 1;