Skip to content

Instantly share code, notes, and snippets.

@pocketkk
pocketkk / keymap.c
Created April 13, 2016 19:20
Chord and Pick Keymap
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
@pocketkk
pocketkk / CheckProductPairs.vb
Created March 30, 2015 20:12
Check Product Pairs
''' <summary>
''' Checks a customer product table to see if product dependencies are met
''' </summary>
''' <param name="customerProducts"></param>
''' <param name="isThrowError"></param>
''' <returns>Dictionary with key value pairs of product_ids</returns>
''' <remarks></remarks>
'''
Protected Function CheckProductPairings(ByVal customerProducts As DataSetApplication.CustomerProductDataTable, _
Optional ByVal isThrowError As Boolean = True) As Dictionary(Of String, String)
@pocketkk
pocketkk / AddParamsFromList_GetParamsFromString.vb
Last active August 29, 2015 14:17
AddParamsFromList_GetParamsFromString
Public Function AddParamsFromList_GetParamsString(ByVal valuesList As List(Of String), ByVal columnName As String, ByRef sqlCommand As SqlCommand) As String
If Not valuesList.Count > 0 Then
Throw New Exception(String.Format("Invalid Argument: List is empty"))
End If
Dim _returnParamString As String = ""
For i As Integer = 0 To valuesList.Count - 1
Dim _paramName As String = String.Format("@{0}{1}", columnName, i)
sqlCommand.Parameters.AddWithValue(_paramName, valuesList(i))
@pocketkk
pocketkk / startx_script
Created December 27, 2014 05:05
Startx on Raspberry pi with tat shield
FRAMEBUFFER=/dev/fb0 startx
@pocketkk
pocketkk / SearchAlgorithm
Last active August 29, 2015 14:09
Swift Search Terms Algorithm
import UIKit
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Helper Function for checking contents of an array //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
extension Array{
func contains<T: Comparable>(val: T) -> Bool{
for x in self {
@pocketkk
pocketkk / avl.swift
Last active November 3, 2015 16:48
AVL Tree
import UIKit
class Thing {
var value : Int
init(v: Int) {
value = v
}
}
class ThingBST {
@pocketkk
pocketkk / bst.swift
Last active August 29, 2015 14:06
Swift - Binary Search Tree
import UIKit
class Thing {
var value : Int
init(v: Int) {
value = v
}
}
class ThingBST {
class Vertice
attr_accessor :predecessor, :d, :name
def initialize(n)
@name = n
end
end
class Edge
attr_accessor :source, :destination, :w
def initialize(s,d,w)
@pocketkk
pocketkk / geocode.swift
Created September 13, 2014 15:36
Swift - Retrieve Lat and Long from Geocode.us
import UIKit
import XCPlayground
XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true)
class Geocode {
var url : NSURL!
var request : NSURLRequest!
let queue : NSOperationQueue = NSOperationQueue()
@pocketkk
pocketkk / distanceLat&Long.swift
Created September 12, 2014 15:16
Swift - Distance between two lat and longs.
struct MapPoint {
var lat : Double = 0
var long : Double = 0
}
class DistanceCalculator {
var fromMP : MapPoint
var toMP : MapPoint
var fLat : Double!