Skip to content

Instantly share code, notes, and snippets.

@theraaz
theraaz / latlon.php
Created January 5, 2016 13:13
calculate distance between two points in php
<?php
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* based on : https://github.com/chrisveness/geodesy */
/* */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/**
* Class LatLon
* Creates a LatLon point on the earth's surface at the specified latitude / longitude.
@theraaz
theraaz / node_big_xml_files.js
Last active February 19, 2016 18:55
process big files in node js, read xml files
/**
* full article at
* http://theraaz.com/javascript/how-to-process-big-files-in-node-js
*/
var bigFileUrl = "http://www.site-containing-big-data/api";
request.get(bigFileUrl)
.on('error', function(errReq) {
console.log('error while reading from big site : ', errReq);
// do something here if you want to throw an exception or something else
@theraaz
theraaz / textareaPlaceholderNewlines.css
Last active March 26, 2016 21:49 — forked from bendechrai/textareaPlaceholderNewlines.css
Textarea Placeholder with Newlines
textarea.placeholder {
color: #aaa;
}
@theraaz
theraaz / webrtc.js
Created August 16, 2017 10:31
webrtc service for AngularJS-1
'use strict';
SR.service('WebRTC', ['$interval', 'MediaLibrary', function ($interval, MediaLibrary) {
var isSecureOrigin = location.protocol === 'https:' ||
location.hostname === 'localhost';
if (!isSecureOrigin) {
alert('HTTPS needed to run this operation');
location.protocol = 'HTTPS';
}
@theraaz
theraaz / Campaign.sol
Created September 6, 2017 19:30 — forked from rob-Hitchens/Campaign.sol
MODULE 5 - START, Hub Contracts and UI
//////////////////////////////////////////////////////////
// For training purposes.
// Solidity Contract Factory
// Module 5 - START
// Copyright (c) 2017, Rob Hitchens, all rights reserved.
// Not suitable for actual use
//////////////////////////////////////////////////////////
pragma solidity ^0.4.6;
@theraaz
theraaz / .travis.yaml
Last active July 13, 2019 15:31
Kubernetes + Travis CI/CD with DigitalOcean - https://medium.com/p/c0c4058b7734
# Use Dockerized infrastructure
sudo: false
language: generic
cache:
bundler: true
git:
depth: 10
@theraaz
theraaz / service-account.yaml
Created July 13, 2019 15:37
Kubernetes + Travis CI/CD with DigitalOcean - https://medium.com/p/c0c4058b7734
apiVersion: v1
kind: ServiceAccount
metadata:
name: cicd
namespace: default
@theraaz
theraaz / cluster-role-binding.yaml
Created July 13, 2019 15:38
Kubernetes + Travis CI/CD with DigitalOcean - https://medium.com/p/c0c4058b7734
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: cicd
subjects:
- kind: ServiceAccount
name: cicd
namespace: default
roleRef:
kind: ClusterRole
@theraaz
theraaz / cluster-role.yaml
Created July 13, 2019 15:39
Kubernetes + Travis CI/CD with DigitalOcean - https://medium.com/p/c0c4058b7734
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: cicd
rules:
- apiGroups: ["", "apps", "batch", "extensions"]
resources: ["deployments", "services", "replicasets", "pods", "jobs", "cronjobs", "secrets", "roles"]
verbs: ["*"]
@theraaz
theraaz / .travis.yaml
Created July 13, 2019 15:40
Kubernetes + Travis CI/CD with DigitalOcean - https://medium.com/p/c0c4058b7734
# Use Dockerized infrastructure
sudo: false
language: generic
cache:
bundler: true
git:
depth: 10