Skip to content

Instantly share code, notes, and snippets.

View eriadam's full-sized avatar

Adam Eri eriadam

View GitHub Profile
@eriadam
eriadam / async-swift-with-awaitkit.swift
Last active May 17, 2018 14:52
Async swift with AwaitKit
// Option 1: Callback Hell
signIn(username: "Foo", password: "Bar") { user in
self.sendWelcomeMailToUser(user) { _ in
self.redirectToThankYouScreen() { _ in
print("All done!")
}
}
}
// Option 2: Promises Chained
@eriadam
eriadam / example-jenkinsfile-pipeline.groovy
Last active March 31, 2024 15:14
example-jenkinsfile-pipeline.groovy
#!groovy
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
}
@eriadam
eriadam / nginx-proxy-for-jenkins.conf
Last active January 11, 2018 13:12
nginx proxy for jenkins
upstream jenkins {
server 127.0.0.1:8080 fail_timeout=0;
}
server {
listen 80;
server_name jenkins.yourserver.com;
return 301 https://$host$request_uri;
}
@eriadam
eriadam / passport-activedirector-dependencies.txt
Created May 8, 2017 21:32
passport-activedirector-dependencies
└─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├─┬ [email protected]
@eriadam
eriadam / iOS-javascript-sharing-data-full-example.js
Last active May 14, 2020 20:31
iOS-JavaScript sharing data full example
/**
* Having imported:
*
* bluebird.min.js
* rx.js
*/
// Business Logic
async function doStuff() {
// Get query from user
@eriadam
eriadam / iOS-javascript-sharing-data-no-3.js
Last active May 14, 2020 20:32
iOS-JavaScript sharing data no. 3
async function doStuff() {
// Load data from the client
let data = await fetchDataFromDatabase(query);
// Show results to user
UI.update(data);
}
@eriadam
eriadam / iOS-javascript-sharing-data-no-2.js
Created January 31, 2017 21:26
iOS-JavaScript sharing data no. 2
function fetchDataFromDatabase(query) {
// Calling iOS method here
return new Promise((resolve, reject) => {
// Timeout and reject.
let timeoutId = setTimeout(() => reject(new Error('Timeout')), 3000);
Rx
@eriadam
eriadam / Rx.observable.function.call.js
Last active January 1, 2018 22:50
Rx Observable Function Call
function fetchDataFromDatabase(query) {
// Calling iOS method here
Rx
.Observable
.create(function subscribe(observer) {
// This will be called by the iOS client
didReceiveDataFromDatabase = function(data) {
// Parse, process your data if needed.
@eriadam
eriadam / iOS-javascript-sharng-data-no-1.js
Last active January 31, 2017 21:09
iOS-JavaScript sharing data no. 1
// Business Logic
function doStuff() {
// Get query from user
// Load data from DB
// Show results to user
}
function fetchDataFromDatabase(query) {
// Calling iOS method here
}
import * as Express from 'express';
let app = Express();
import {Bootstrap} from './api/bootstrap';
new Bootstrap(app);