Skip to content

Instantly share code, notes, and snippets.

View AugustoPedraza's full-sized avatar

Augusto AugustoPedraza

View GitHub Profile
@AugustoPedraza
AugustoPedraza / api_integration_poc.rb
Last active January 28, 2016 20:29
Yodlee API Integration
class Yodlee:Api::V1::RequestBuilder
METADATA_REQUESTS =
{
get_user_info: { method: :get, path: '/user' },
list_accounts: { method: :get, path: '/accounts' },
create_user: { method: :post, path: '/user/register' }
}
attr_accessor :cobrand_session, :user_session
@AugustoPedraza
AugustoPedraza / specs_outline.rb
Created October 31, 2015 15:03
WEDIDIT- Rails Engineer Interview : Mini-coding exercise
## Given the following User Story:
## As a registered User,
## I want to send a technical request to the sys admin,
## So that they are aware I have a problem.
## Acceptance criteria
## * Email sent to ENV['ADMIN_EMAIL']
## Provide a "spec outline" which clearly shows what you will be testing, illustrated by file locations and
## statement hierarchy without actually writing any [implementation] code, for example:
# Given the word list, count how many words are in the dictionary.
# Note: This isn't the most efficient way to do thise. If I was going for
# speed, I would have made each dicitonary word the key of a hash, and
# had O(n) lookup times.
def process_words(words, dictionary)
puts "Starting thread #{Thread.current.object_id}\n"
found = 0
words.each do |word|
if dictionary.include? word
@AugustoPedraza
AugustoPedraza / ranking-sort.js
Last active August 29, 2015 14:01
Really simpler chrome console "ñoño" filter sorter for http://torrentbutler.eu/
var internalId = setInterval(function() {
$("html, body").animate({ scrollTop: $(document).height()-$(window).height() });
setTimeout(function() {
$('a.movie').each(function(i, el) {
var $el = $(el);
var styleValue = $($el.find('span.rating > span')[0]).attr('style');
var ranking = parseFloat((styleValue || '-1').substring(7).replace("%;", ''));
if (isNaN(ranking)|| ranking < 80) {
$el.remove();
@AugustoPedraza
AugustoPedraza / ActiveDirectory.cs
Created March 18, 2014 17:47
Listing users and groups from ActiveDirectory
using System;
using System.Collections.Generic;
using System.DirectoryServices.AccountManagement;
using System.Linq;
namespace AugustoPedraza.Utils
{
public class ActiveDirectory
{
public static string Domain { get; set; }
using System;
using System.Collections.Generic;
using System.Data;
namespace GetJsonCollectionFromDataTable
{
class Program
{
static void Main()
{
@AugustoPedraza
AugustoPedraza / functional_programming.js
Created March 5, 2013 16:09
Using inheritance with functional programming. This example was taken from the book "Javascript: The Good Parts".
var mammal = function(spec){
var that = {};
that.getName = function( ){
return spec.name;
};
that.says = function( ){
return spec.saying || '';
};
@AugustoPedraza
AugustoPedraza / scopes.js
Created March 4, 2013 16:32
Example scope...
function logValues(head, four, five, six){
console.log(head);
console.log("four = " + four);
console.log("five = " + five);
console.log("six = " + six );
console.log("\n");
}
var integers = function( ){
var four = 4;
@AugustoPedraza
AugustoPedraza / extract_integer_from_number.js
Created March 4, 2013 15:53
Simple augmenting function to "Function.prototype" to extract just the integer part of a number and removes spaces from the ends of a string. This example was taken from the book "Javascript: The Good Parts".
//Define method to add a method available to all functions.
Function.prototype.method = function(name, func){
this.prototype[name] = func;
return this;
};
Number.method('integer', function( ){
return Math[this < 0 ? 'ceil' : 'floor'](this);
})
@AugustoPedraza
AugustoPedraza / exception_sample.js
Created March 4, 2013 15:26
Exceptions example. This example was taken from the book "Javascript: The Good Parts".
var add = function(a, b){
var invalidTypes = (typeof a !== 'number' || typeof b !== 'number');
if(invalidTypes){
throw {
name: "TypeError",
message: "add needs numbers"
};
}