This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('#add-team-submit').on('click', function(e) { | |
e.preventDefault() | |
FormHelper.submit('#team-add-modal form', '{{ csrf_token() }}') | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Django settings for weiloapi project. | |
Generated by 'django-admin startproject' using Django 2.2.12. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/2.2/topics/settings/ | |
For the full list of settings and their values, see | |
https://docs.djangoproject.com/en/2.2/ref/settings/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Hello World"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentController extends BaseController | |
{ | |
/** | |
* @var CommentService | |
*/ | |
private $commentService; | |
public function __construct(CommentService $commentService) | |
{ | |
parent::__construct(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$verifyToken = generateToken(); | |
while(User::where('verify_token', '=', $verifyToken)->exists()) { | |
$verifyToken = generateToken(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func register(_ req: Request) throws -> Future<UserResponse> { | |
return try req.content.decode(CreateUserRequest.self).flatMap { user -> Future<User> in | |
guard user.password == user.verifyPassword else { | |
throw Abort(.badRequest, reason: "Password and verification must match.") | |
} | |
let hash = try BCrypt.hash(user.password) | |
return User(id: nil, name: user.name, email: user.email, password: hash, acceptedTos: user.acceptedTos, acceptedAds: user.acceptedAds) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func encode(apiKey: String) throws -> String { | |
guard let apiKeyData = "api:\(apiKey)".data(using: .utf8) else { | |
throw Error.encodingProblem | |
} | |
let authKey = apiKeyData.base64EncodedData() | |
guard let authKeyEncoded = String.init(data: authKey, encoding: .utf8) else { | |
throw Error.encodingProblem | |
} | |
return authKeyEncoded |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func email(_ req: Request) throws -> Future<Response> { | |
let message = Mailgun.Message( | |
from: "[email protected]", | |
to: "[email protected]", | |
subject: "Newsletter", | |
text: "This is a newsletter", | |
html: "<h1>This is a newsletter</h1>" | |
) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FluentMySQL | |
import Vapor | |
/// Called before your application initializes. | |
public func configure(_ config: inout Config, _ env: inout Environment, _ services: inout Services) throws { | |
// Register providers first | |
try services.register(FluentMySQLProvider()) | |
// Register routes to the router | |
let router = EngineRouter.default() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($request->has('xing')) { | |
if ($job->hasMedia('xing')) { | |
$image = $job->getFirstMediaUrl('xing'); | |
} else { | |
$image = $job->employer->hasMedia('avatar') ? $job->employer->getFirstMediaUrl('avatar') : asset('/images/opengraph.jpg'); | |
} | |
} else if ($request->has('linkedin')) { | |
if ($job->hasMedia('linkedin')) { | |
$image = $job->getFirstMediaUrl('linkedin'); | |
} else { |
NewerOlder