Skip to content

Instantly share code, notes, and snippets.

View fdcore's full-sized avatar
🦄
Работаю круглосуточно

Dmitriy Nyashkin fdcore

🦄
Работаю круглосуточно
View GitHub Profile
@drewgates
drewgates / send_email.php
Last active November 30, 2016 09:52
Send email with mailgun.
<?php
//from email can be set in the relevant curl_setopt below.
//for my purposes, I was always using the same from email and didn't need one more variable to pass into this function.
//
function send_mail($email,$subject,$msg,$mailDomain,$api) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, 'api:'.$api_key);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Author : Vitor Rodrigues Di Toro
# E-Mail : vitorrditoro@gmail.com
# Date : 14/03/2018
# Last Update : 19/03/2018
#
import unittest
@CubexX
CubexX / plural.py
Created July 13, 2018 22:15
Python plural russian days / Склонение день/дня/дней
def plural_days(n):
days = ['день', 'дня', 'дней']
if n % 10 == 1 and n % 100 != 11:
p = 0
elif 2 <= n % 10 <= 4 and (n % 100 < 10 or n % 100 >= 20):
p = 1
else:
p = 2
@mmolucio
mmolucio / cors-nginx.conf
Created April 30, 2020 15:21 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#