Skip to content

Instantly share code, notes, and snippets.

View javi830810's full-sized avatar

Javier de Paula javi830810

  • Ultimate Software
  • Miami, FL
View GitHub Profile
@javi830810
javi830810 / my_dict.go
Last active May 10, 2016 15:54
My Dictionary
package main
import (
"errors"
"fmt"
)
type KeyPair struct{
key string
value string
arr = [1,2,3, 4, 5, 6]
#In Place
def binary_search(elem, arr, init=None, end=None):
if not init and not end:
init = 0
end = len(arr)
if end < init or init >= len(arr):
class BTree(object):
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def bfs(self):
def is_int(c):
return ord(c) >= 48 and ord(c) <= 58
def get_int(c):
return ord(c) - 48
def int_to_parse(input):
result = 0
for x in xrange(0, len(input)):
character = input[x]
def pow(a,b):
if b == 0:
return 1
if b == 1:
return a
if b % 2 == 1:
return pow(a,b/2)*pow(a,b/2)*a
if b % 2 == 0:
return pow(a,b/2)*pow(a,b/2)
@javi830810
javi830810 / polish_notation.py
Last active October 15, 2015 14:38
Polish notation
class Stack(object):
def __init__(self):
self.stack = []
def push(self, elem):
self.stack.append(elem)
@javi830810
javi830810 / triplebyte.py
Created September 23, 2015 19:14
Operator insertion
def f(digits, target, current=None, rest=None):
"""
It doesnt work for the given case, it does for small runs
Some performance situation...
The idea is to try each digit with each of the operators
once the digit have been used, it will be appended to the current
and a new iteration will be done with the other digits.
@javi830810
javi830810 / cities.py
Last active September 25, 2015 14:22
from sys import stdin
#amount = int(stdin.readline())
class Node(object):
def __init__(self, id):
self.id = id
self.neighboors = []
class Edge(object):
@javi830810
javi830810 / get_all_palettes.py
Last active August 29, 2015 14:23
Palette Generation
from models import Palette
palettes = []
for x in Palette.query().fetch():
palettes.append({
'name': x.name,
'bg_color':x.main_bg_color,
'color': x.main_color
})
@javi830810
javi830810 / PipelineDefinition
Last active September 25, 2015 14:22
Publish Action
public IPipeline GetPipelineForMessage(EventMessage message)
{
return new LinearPipeline () {
Actions = new List<IAction> () {
new JF.JotFormAPIAction () { },
new WebhookPublishAction () {
MessageType = "JotFormFullMessage",
Bus = this.container.Resolve<IBus> (),
WebhookStore = container.Resolve<IWebhookStore> (),
}