Skip to content

Instantly share code, notes, and snippets.

View kashifshaikh's full-sized avatar

Kashif Shaikh kashifshaikh

  • Dapper Labs
  • Toronto, Ontario, Canada
  • 08:58 (UTC -04:00)
  • X @kashifshaikh
View GitHub Profile
@ggonchar
ggonchar / swagger_oauth2_client_grant.yaml
Created September 30, 2016 09:01
Swagger 2.0 yaml spec for OAuth 2.0 implementation with client grant
swagger: '2.0'
info:
title: Authentication API
description: |
Implementation of [OAuth 2.0](https://tools.ietf.org/html/rfc6749 "Docs") with Client Credentials Grant type
version: "1.0.0"
host: localhost:3000
schemes:
- http
- https
@popravich
popravich / PostgreSQL_index_naming.rst
Last active June 9, 2026 07:55
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@Jerrot
Jerrot / ArrayTransform.swift
Last active March 17, 2024 13:10
Transform arrays with ObjectMapper to Realm's List type
// Based on Swift 1.2, ObjectMapper 0.15, RealmSwift 0.94.1
// Author: Timo Wälisch <timo@waelisch.de>
import UIKit
import RealmSwift
import ObjectMapper
import SwiftyJSON
class ArrayTransform<T:RealmSwift.Object where T:Mappable> : TransformType {
typealias Object = List<T>
@Tetr4
Tetr4 / ForceCacheOrNetwork.java
Last active February 1, 2020 05:17
How to force a cached or network response on Android with Retrofit + OkHttp
OkHttpClient okHttpClient = new OkHttpClient();
try {
int cacheSize = 10 * 1024 * 1024 // 10 MiB
Cache cache = new Cache(getCacheDir(), cacheSize);
okHttpClient.setCache(cache);
} catch (IOException e) {
Log.e(TAG, "Could not set cache", e);
}
// Forces cache. Used for cache connection
@lucdew
lucdew / json_postgres.js
Last active April 12, 2025 09:09
Example of json document storage in postgresql and querying (with knex.js)
var connectionString = 'postgres://localhost:5432/postgres';
var Promise=require('bluebird');
var knex = require('knex')({
client: 'pg',
connection: {
user: 'postgres',
database: 'postgres',
port: 5432,
@jbuda
jbuda / gist:9888066
Created March 31, 2014 08:44
Compiling 32/64 bit for devices and simulators for Objective-C and XCode
# folder vars
FOLDERNAME=${PROJECT_NAME}
LIBRARYNAME="lib${PROJECT_NAME}.a"
OUTPUTFOLDER=${SRCROOT}/build/${FOLDERNAME}
# make sure the output directory exists
mkdir -p "${OUTPUTFOLDER}"
# device / simulator builds
xcodebuild -project "${PROJECT_NAME}.xcodeproj" -configuration "Release" -sdk "iphoneos7.1" clean build ARCHS="armv7 armv7s" IPHONEOS_DEPLOYMENT_TARGET="5.0" TARGET_BUILD_DIR="${BUILD_DIR}/build-arm" BUILT_PRODUCTS_DIR="${BUILD_DIR}/build-arm"
@eoghain
eoghain / acknowledgements.py
Last active August 25, 2018 02:16
Python script to generate plists into a Settings.bundle for all licenses of open source software you are using in your application.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Setup
#
# 1. Create a directory to hold your 3rd party code, each module in it's own named directory (i.e. 3rdParty/AFNetworking).
# 2. Make sure under the module directory there is the LICENSE file (file must have LICENSE all uppercase in the name)
# 3. In your Settings.bundle add a row to the Root.plist with: Type=PSChildPaneSpecifier, Filename=Acknowledgements, Name=Acknowledgements.
# 4. In the script below,
# - set the settingsDir to the directory where the Settings.bundle resides (if not source root),
@zetachang
zetachang / gist:4111314
Created November 19, 2012 15:37
Instruction on adding a Acknowledgements Settings.bundle
  • To add Settings.bundle in Xcode. Command N and in Resource, choose Settings Bundle .
  • Open Root.plist in source code, paste the code below to replace it,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>PreferenceSpecifiers</key>
	
@troyk
troyk / contacts.js
Created February 23, 2012 12:38
Mongoose multiple schemas in single collection
// Don't care much about inheritance at this point, but I'll probably attempt it at
// some point via cloning ancestor schema's
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
var Contact = new Schema({
_type: String,
name: String
});