Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* UUID class
*
* The following class generates VALID RFC 4211 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.
@sankar4n
sankar4n / build.gradle
Created July 27, 2016 18:29 — forked from luciofm/build.gradle
Auto increment version number on release builds... You can change the build type on versionCode.gradle, you also will need to commit and push gradle.properties on your CI
apply from: 'versionCode.gradle'
android {
defaultConfig {
versionName VERSION_NAME
versionCode Integer.parseInt(VERSION_CODE)
}
}
@sankar4n
sankar4n / ExtractPeerCertificate.java
Created September 1, 2016 13:14
Extracts public key has for HPKP Pinning
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Base64;
@sankar4n
sankar4n / IndianStates.json
Last active July 2, 2017 05:31 — forked from shubhamjain/IndianStates.json
Indian States and Union Territories in JSON format
[
{
"code": "AN",
"name": "Andaman and Nicobar Islands"
},
{
"code": "AP",
"name": "Andhra Pradesh"
},
{
@sankar4n
sankar4n / loadgtfs.cql
Created November 27, 2018 10:12 — forked from rvanbruggen/loadgtfs.cql
Loading and Querying GTFS data
//LOAD CSV script for GFTS data
create constraint on (a:Agency) assert a.id is unique;
create constraint on (r:Route) assert r.id is unique;
create constraint on (t:Trip) assert t.id is unique;
create index on :Trip(service_id);
create constraint on (s:Stop) assert s.id is unique;
create index on :Stoptime(stop_sequence);
create index on :Stop(name);
schema await
@sankar4n
sankar4n / gist:39b07a51708638686a1c252ae10e4bb1
Created March 31, 2019 12:55 — forked from acj/TrimVideo.swift
Trim video using AVFoundation in Swift
//
// TrimVideo.swift
// VideoLab
//
// Created by Adam Jensen on 3/28/15.
// Copyright (c) 2015 Adam Jensen. All rights reserved.
//
import AVFoundation
import Foundation
@sankar4n
sankar4n / xcode-build-bump.sh
Created April 1, 2019 09:59 — forked from mattpotts/xcode-build-bump.sh
Auto-increment Xcode target build number every time the project is archived
# xcode-build-bump.sh
# @desc Auto-increment Xcode target build number every time the project is archived
# @src stackoverflow.com/a/15483906
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@sankar4n
sankar4n / EventEmitter.swift
Created April 3, 2019 04:48 — forked from brennanMKE/EventEmitter.swift
React Native Event Emitter for RCTEventEmitter in Objective-C and Swift
class EventEmitter
/// Shared Instance.
public static var sharedInstance = EventEmitter()
// ReactNativeEventEmitter is instantiated by React Native with the bridge.
private static var eventEmitter: ReactNativeEventEmitter!
private init() {}
@sankar4n
sankar4n / bridge.md
Created July 25, 2019 16:14 — forked from kiok46/bridge.md
Bridge React-Native and JS

Content of the Gist is from a talk by Peggy Rayzis at Chain React 2017: Chain React 2017: Breaking Down Bridging in React Native by Peggy Rayzis


In order for a native code to talk to JS you would need a bridge.

  • You need to integrate a third-party SDK.
  • High perfomance is crutial
  • You are building a brownfiel app
  • You need access to a platform to a platform API. (Camera, Gyroscope etc.), You will need to use a opensource library or create a bridge.
#cloud-config
package_upgrade: true
write_files:
- path: /etc/systemd/system/docker.service.d/docker.conf
content: |
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd
- path: /etc/docker/daemon.json
content: |