Skip to content

Instantly share code, notes, and snippets.

View Yakubina's full-sized avatar

Nick Yakubina Yakubina

View GitHub Profile
@jarnheimer
jarnheimer / SocialSecurityNumber.php
Created July 7, 2019 12:16
Class to handle Swedish Social Security Number
<?php namespace App\Apply\Helpers;
use App\Exceptions\SwedishSocialSecurityNumberException;
use Carbon\Carbon;
use DateTime;
use Exception;
/**
* Extracts data, manipulates and validates swedish security numbers
*
@ar-android
ar-android / Download.php
Created July 7, 2017 07:13
Download file using guzzle
<?php
class Download {
public function download($url, $name, $extensions){
$path = __DIR__.'/download/' . $name . $extensions;
$file_path = fopen($path,'w');
$client = new \GuzzleHttp\Client();
$response = $client->get($url, ['save_to' => $file_path]);
return ['response_code'=>$response->getStatusCode(), 'name' => $name];
}
@yajra
yajra / axios-401-response-interceptor.js
Last active September 20, 2023 06:24
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@LeCoupa
LeCoupa / redis_cheatsheet.bash
Last active March 18, 2024 09:08
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@taleeb35
taleeb35 / ChainSelection.php
Created September 20, 2014 03:32
Chain Selection in Cakephp
<?php
App::uses('AppController', 'Controller');
class CountriesController extends AppController {
public $helpers = array('Js');
public $components = array('RequestHandler');
public function select() {
$countries = $this->Country->find('list');
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/