Skip to content

Instantly share code, notes, and snippets.

@sicaboy
sicaboy / .env.travis
Created April 17, 2018 02:17 — forked from qWici/.env.travis
Laravel 5.5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@brandonb927
brandonb927 / image-2x.less
Last active December 1, 2019 15:38
@2x LESS CSS Mixin
/**
* I converted the SCSS mixin to LESS for the awesome coders like myself in response to a blog post on 37Signals - http://37signals.com/svn/posts/3271-easy-retina-ready-images-using-scss
*
* Update: 2014-08-04 - Updated a long-standing bug where retina images were shown no matter what in the first background-image property.
* - Updated retina media query to be more reliable ()
* Update: 2013-11-13 - Picked up another technique thanks to reading this post from Tyler Tate, auto-fill in the second filename for the retina image, http://tylertate.com/blog/2013/06/11/retina-images-using-media-queries-and-LESS-CSS.html
* Update: 2013-04-16 - Have recently found a few use cases when using a retina pattern from Subtle Patterns on the <body>, this has come in handy
* Update: 2013-04-05 - Some research in the Wordpress Core(http://core.trac.wordpress.org/ticket/22238#comment:5) was pointed out that some tests may be redundant (Thanks @kbav) so I've cleaned these up
* Update: 2012-12-29 - U
@qWici
qWici / .env.travis
Last active February 25, 2020 00:24 — forked from gilbitron/.env.travis
Laravel 5.5 Travis CI config
APP_ENV=testing
APP_KEY=SomeRandomString
DB_CONNECTION=testing
DB_TEST_USERNAME=root
DB_TEST_PASSWORD=root
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=sync
@gupta-pratik
gupta-pratik / app.js
Last active March 9, 2020 14:13
AngularJs Authorization and permissions on routes and views.
'use strict';
// Declare app level module which depends on views, and components
var app = angular.module('eopd', [
'ngRoute',
'app.directives'
'app.services'
])
.config([
'$locationProvider', '$routeProvider', '$httpProvider', 'ScrollBarsProvider', function ($locationProvider, $routeProvider, $httpProvider, ScrollBarsProvider) {
@iamntz
iamntz / HandlePutFormData.php
Last active January 20, 2021 05:17 — forked from Stunext/HandlePutFormData.php
Laravel: Middleware to support multipart/form-data in PUT, PATH and DELETE requests. Deals with one level of form arrays.
<?php
namespace App\Http\Middleware;
use Closure;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
* @author https://github.com/Stunext
*
* PHP, and by extension, Laravel does not support multipart/form-data requests when using any request method other than POST.
@blazarecki
blazarecki / PopupDictionary.php
Last active November 10, 2021 15:54
Alert, confirm and prompt with mink
<?php
namespace Widop\Mink\Extension;
/**
* Dictionary to manage popups.
*
* @author Benjamin Lazarecki <benjamin.lazarecki@gmail.com>
*/
trait PopupDictionary
@tlarevo
tlarevo / swift-compatible-php-aes-encryption-using-mcrypt.php
Last active January 5, 2022 15:59
Swift compatible AES Encryption and Decryption with PHP and mcrypt
<?php
// Credit should be given to;
// https://gist.github.com/bradbernard/7789c2dd8d17c2d8304b#file-php-encyrption
// https://gist.github.com/krzyzanowskim/043be69ab3ba9fd5ba58#file-encryptaeswithphp
$data = '{"verification_code":"123456"}';
$key = '1234567890123456';
function aesEncrypt($data, $key) {
$data = addPadding($data);
@tlarevo
tlarevo / php-compatible-swift-aes-encryption-using-cryptoswift.swift
Last active January 5, 2022 15:59
PHP compatible AES Encryption and Decryption with Swift and CryptoSwift
// Credit should be given to;
// https://gist.github.com/yutelin/f4f66e0c78474db1de51#file-string-aes-swift
// https://gist.github.com/bradbernard/2a7af4c2200cb3794768#file-swift-encryption
// And most importantly to https://github.com/krzyzanowskim/CryptoSwift
import Foundation
import CryptoSwift
extension String {

SAMPLE

127.0.0.1 - - [26/Mar/2016:19:09:19 -0400] "GET / HTTP/1.1" 401 194 "" "Mozilla/5.0 Gecko" "-"

MATCH

%{IPORHOST:clientip} (?:-|(%{WORD}.%{WORD})) %{USER:ident} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent} %{QS:forwarder}

Output

@simme
simme / debounce-throttle.swift
Created December 20, 2016 10:04
Swift 3 debounce & throttle
//
// debounce-throttle.swift
//
// Created by Simon Ljungberg on 19/12/16.
// License: MIT
//
import Foundation
extension TimeInterval {