Skip to content

Instantly share code, notes, and snippets.

View Nikoloutsos's full-sized avatar

Konstantinos Nikoloutsos Nikoloutsos

  • Athens, Greece
View GitHub Profile
@Nikoloutsos
Nikoloutsos / .php
Created April 1, 2020 15:35
Sharing code with John pragias
<?php
// Get student email
$email = isset($_POST['email']) ? $_POST['email'] : die();
// Include third party library classes
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '../util/phpmailer/Exception.php';
require '../util/phpmailer/PHPMailer.php';
@Nikoloutsos
Nikoloutsos / script for sending push notification to android phone
Created November 20, 2020 22:56
Send push notification from firebase to android device
const GOOGLE_API_KEY = "XXXXX";
const GOOGLE_GCM_URL = "https://fcm.googleapis.com/fcm/send";
$fields = array(
'to' => $device_token,
'sound' => 'default',
'priority' => 'high',
'data' => array("title" => $this-title,
"message" => $this->message // You may add more data
)
// sourcery: AutoMockable
protocol FooProtocol {
func foo1()
func foo2() -> String
func foo3(str: String, int: Int) -> Int
}
// sourcery: AutoMockable
protocol FooProtocol {
func foo1()
func foo2() -> String
func foo3(str: String, int: Int) -> Int
}
class FooProtocolMock: FooProtocol {
//MARK: - foo1
var foo1CallsCount = 0
var foo1Called: Bool {
return foo1CallsCount > 0
}
var foo1Closure: (() -> Void)?
func foo1() {
{% for type in types.protocols where type|annotated:"MyFirstSpell" %}
{% for method in type.allMethods %}
// I found method {{method.shortName}}
{%endfor%}
{% endfor %}
{% for type in types.protocols where type|annotated:"MyFirstSpell" %}
class MyFirstDayAtMagicalSchool {
{% for method in type.allMethods %}
//MARK: {{method.shortName}} transformed to frog-prefix
func frog_{{method.name}} {}
{%endfor%}
}
{% endfor %}
// sourcery: MyFirstSpell
protocol BoomProtocol {
func boom1()
func boom2() -> String
func boom3(str: String, int: Int)
func boom4(args: String...)
}
// Generated using Sourcery 1.6.0 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
class MyFirstDayAtMagicalSchool {
//MARK: boom1 transformed to frog-prefix
func frog_boom1() {}
//MARK: boom2 transformed to frog-prefix
func frog_boom2() {}
//MARK: boom3 transformed to frog-prefix
func frog_boom3(str: String, int: Int) {}
// swiftlint:disable line_length
// swiftlint:disable variable_name
// ❤️ https://github.com/krzysztofzablocki/Sourcery/blob/master/Templates/Templates/AutoMockable.stencil
{% for import in argument.autoMockableImports %}
import {{ import }}
{% endfor %}
{% for import in argument.autoMockableTestableImports %}
@testable import {{ import }}
{% endfor %}
{% macro swiftifyMethodName name %}{{ name | replace:"(","_" | replace:")","" | replace:":","_" | replace:"`","" | snakeToCamelCase | lowerFirstWord }}{% endmacro %}