Skip to content

Instantly share code, notes, and snippets.

@khle
khle / 0_reuse_code.js
Created September 25, 2015 13:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@khle
khle / gist:4c7a7627733447ea1dae
Created March 24, 2016 03:38 — forked from felixgborrego/gist:7943560
To call Camera or Gallery Intent or any other intent in relation with photos. 1- look for all the available apps in the phone 2- Show a popup with the list of apps
package com.daft.ie.client.widget;
import java.util.ArrayList;
import java.util.List;
import com.daft.ie.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
@khle
khle / AppDelegate.swift
Created August 30, 2016 05:08 — forked from tfrank64/AppDelegate.swift
Swift UITabBar Programmatically
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
var nav1 = UINavigationController()
var first = FirstViewController(nibName: nil, bundle: nil)
nav1.viewControllers = [first]
var second = SecondViewController(nibName: nil, bundle: nil)
var nav2 = UINavigationController()
@khle
khle / LineEntry.cs
Created January 2, 2017 16:16 — forked from davidtavarez/LineEntry.cs
Xamarin.Forms Entry just with bottom border.
using Xamarin.Forms;
namespace YOUTNAMESPACE
{
public class LineEntry : Entry
{
public static readonly BindableProperty BorderColorProperty =
BindableProperty.Create<LineEntry, Color> (p => p.BorderColor, Color.Black);
public Color BorderColor {
@khle
khle / variance.md
Created January 10, 2017 21:53 — forked from maiermic/variance.md
Description of the four kinds of variance: covariance, contravariance, invariance and bivariance.

Variance

The term variance describes how subtyping between higher kinded types is related to subtyping relations of their type arguments.

Higher Kinded Types

A higher kinded type composes type arguments to a new type. I use square bracket notation to define a higher kinded type:

C[T] // The higher kinded type `C` composes type argument `T` to a new type `C[T]`.

The same works with multiple type arguments:

@khle
khle / javascript
Created September 8, 2017 18:13 — forked from heldrida/javascript
Facebook Javascript SDK: Basic Login and Logout example
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'xxxxxxxxxxxxx',
status: true,
cookie: true,
xfbml: true
});
@khle
khle / gist:733a6441558d672050ebad2e06fe615c
Created January 23, 2018 19:45 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@khle
khle / gist:11460e4be69bb5cd2e8f12ecf0b52e66
Created January 30, 2018 16:23 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@khle
khle / jwtRS256.sh
Created April 24, 2018 20:55 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@khle
khle / AzureFunctionLog.cs
Last active October 26, 2018 22:31 — forked from roryprimrose/Function1.cs
Azure Functions with ILogger example
namespace FunctionApp1
{
using Autofac;
using Autofac.Core;
using EnsureThat;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Description;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs.Host.Config;