Skip to content

Instantly share code, notes, and snippets.

@hsharghi
hsharghi / User.swift
Last active May 31, 2018 12:20
User model for Blog API
import FluentMySQL
import Vapor
final class User: MySQLModel { // 1
/// The unique identifier for `User` // 2
var id: Int?
// Additional properties of `User` // 3
var email: String
var password: String
@hsharghi
hsharghi / Package.swift
Created May 31, 2018 10:51
Blog API using Vapor 3
// swift-tools-version:4.0
import PackageDescription
let package = Package(
name: "blog",
dependencies: [
// 💧 A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
// 🔵 Swift ORM (queries, models, relations, etc) built on MySQL.
@hsharghi
hsharghi / countdown.js
Created January 4, 2017 13:40 — forked from adhithyan15/countdown.js
A simple countdown timer in Javascript
/********************************************************************************************************************
Countdown.js is a simple script to add a countdown timer
for your website. Currently it can only do full minutes
and partial minutes aren't supported. This script is a fork of http://jsfiddle.net/HRrYG/ with some
added extensions. Since the original code that I forked was released under Creative Commons by SA license,
I have to release this code under the same license. You can view a live demo of this code at http://jsfiddle.net/JmrQE/2/.
********************************************************************************************************************/
function countdown(minutes) {
var seconds = 60;
var mins = minutes
@hsharghi
hsharghi / ArrayFunctions.mq4
Last active November 7, 2016 12:12 — forked from currencysecrets/ArrayFunctions.mq4
Array utility functions for MetaTrader 4. Helpful functions for doing some of the repetitive tasks in MQL.
/*
* clearIntArray
* This function deletes all items in array (sets it to 0) and resizes array according to size (default = 1).
* @param int& theArray - passing the array by reference
* @param int size - size of the array (default = 1)
* @return int blank array of size
*/
int clearIntArray( int& theArray[], int size = 0 ) {
ArrayResize( theArray, size );
if ( size > 0 ) { ArrayInitialize( theArray, 0 ); }