Skip to content

Instantly share code, notes, and snippets.

View stormwild's full-sized avatar
🏠
Working from home

Alexander R Torrijos stormwild

🏠
Working from home
View GitHub Profile
@mikebridge
mikebridge / DemoTests.cs
Created February 20, 2018 20:28
Mock EF DbContext with SQLite for XUnit Test
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
// ...
public static MyDbContext InMemoryContext()
{
// SEE: https://docs.microsoft.com/en-us/ef/core/miscellaneous/testing/sqlite
var connection = new SqliteConnection("Data Source=:memory:");
var options = new DbContextOptionsBuilder<MyDbContext>()
.UseSqlite(connection)
@sarahdayan
sarahdayan / modifiers.scss
Last active October 31, 2023 18:28
Sass Modifiers Mixin
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
// Sass modifiers mixin by Sarah Dayan
// Generate All Your Utility Classes with Sass Maps: frontstuff.io/generate-all-your-utility-classes-with-sass-maps
// http://frontstuff.io
// https://github.com/sarahdayan
@laacz
laacz / php-fpm-apache-on-wsl.md
Last active July 27, 2023 15:48
PHP 7.x (FPM), Apache2 on WSL

PHP-FPM, Apache with *.localhost virtualhosts on WSL

This will help installing simple PHP stack with *.localhost domains on Windows Subsystem for Linux in Windows 10. You'll have to add sudo where appropriate.

PHP 7.x (FPM)

You'll need to add an unofficial repository by awesome Ondřej Surý, but it's been stable for years and can be used in production.

sudo apt-get install -y python-software-properties
@karlhillx
karlhillx / macos_high_sierra_apache_php_brew_2018.md
Last active March 13, 2024 02:42
macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

Homebrew Installation

First let's install Homebrew.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

@Vladimir-Novick
Vladimir-Novick / AmazonS3FileReader
Last active September 20, 2020 07:24
Amazon S3 File Downloader ( C# Class )
public class AmazonS3FileReader
{
private AmazonS3Client GetAmazonS3Client()
{
AmazonS3Client _client = new AmazonS3Client(
HttpFileReaderConfig.GetConfigData.AmazonS3AccessKey,
HttpFileReaderConfig.GetConfigData.AmazonS3SecretKey,
new AmazonS3Config { ServiceURL = HttpFileReaderConfig.GetConfigData.ServiceURL }
);
return _client;
@javilobo8
javilobo8 / download-file.js
Last active April 9, 2024 12:01
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
function factorial(n) {
if (n == 0) {
return 1;
}
setTimeout(
function() {
console.log('enqueued', n);
},
0
)
@QWp6t
QWp6t / Bootstrap.php
Created April 16, 2017 03:20
NavWalkers
<?php namespace App\NavWalker;
use Roots\Soil\Nav\NavWalker as SoilNavWalker;
/**
* @author QWp6t
* @license OSL-3.0
*/
class Bootstrap extends SoilNavWalker
{
@RebeccaWhit3
RebeccaWhit3 / Keyboard HTML Tag for Github Markdown.md
Created March 14, 2017 02:12
Keyboard HTML Tag for Github Markdown

Keyboard HTML Tag for Github Markdown

Examples:

control + shift + space

command/control + ,

👆/👇/👈/👉

@patrocle
patrocle / Nginx + Apache reverse proxy REAL IP.md
Last active April 25, 2024 15:02
Real IP for Apache (Nginx reverse proxy)

NGINX 1.10 + APACHE 2.4 real IP for reverse proxy

Edit nginx conf

default.conf or what you want

vim /etc/nginx/conf.d/default.conf

add proxy_set_header for php files