Skip to content

Instantly share code, notes, and snippets.

View etiennemarais's full-sized avatar
🇿🇦
...

Etienne Marais etiennemarais

🇿🇦
...
View GitHub Profile
@adamwathan
adamwathan / database.php
Created May 2, 2014 20:07
Using an in-memory SQLite for functional testing in Laravel 4
<?php
// app/config/testing/database.php
return [
'default' => 'sqlite',
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
// ...
let webpack = require("webpack");
mix.webpackConfig({
plugins: [
// Choose the language you want to keep (Ex: "fr")
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fr/)
]
});
@edorgeville
edorgeville / release.sh
Last active May 1, 2019 20:14
Creates a signed and zipaligned APK from your Ionic project
#!/bin/bash
#
# Creates a signed and zipaligned APK from your Ionic project
#
# Place your keystore in the root of your project and name it <company>.keystore
# Use this script as following :
# $ ./release.sh [company] [version]
#
# Don't forget to gitignore your key and your compiled apks.
#

Setting up SSH Keys for Gitlab

( Mac & Windows Instructions )

Step 1 - Generate SSH Keys

Generate SSH Key by running the following command:

Mac Users Windows Users
Open your terminal open the Git Bash terminal
@kare
kare / go-unit-test-setup-and-teardown-math_setup_and_teardown_test.go
Created November 22, 2016 17:53
Go unit test setup and teardown math_test.go
package math
import "testing"
func setupTestCase(t *testing.T) func(t *testing.T) {
t.Log("setup test case")
return func(t *testing.T) {
t.Log("teardown test case")
}
}
@buonzz
buonzz / add_service.php
Created August 24, 2014 01:56
add service provider in laravel dynamically
App::register('MyApp\Providers\MyServiceProvider');
@victorbstan
victorbstan / php_object_to_array.php
Created December 17, 2010 04:18
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@mabasic
mabasic / helpers.php
Last active October 27, 2022 16:52
config_path function for Lumen framework
<?php
if ( ! function_exists('config_path'))
{
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
@inetbiz
inetbiz / site.conf
Last active March 25, 2023 18:56 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@paulund
paulund / css-purge-webpack-config.js
Last active April 7, 2023 10:02
Using CSS Purge With Laravel Mix. Tutorial on how to use the following can be found https://paulund.co.uk/reduce-css-file-size-with-css-purge reduced a production ready CSS file from 179kb to 7.9kb.
mix.webpackConfig({
plugins: [
new purgeCss({
paths: glob.sync([
path.join(__dirname, 'resources/views/**/*.blade.php'),
path.join(__dirname, 'resources/assets/js/**/*.vue')
]),
extractors: [
{
extractor: class {