Skip to content

Instantly share code, notes, and snippets.

View kirkconnell's full-sized avatar

Carlos Kirkconnell kirkconnell

  • Google
  • Mountain View, CA
View GitHub Profile
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
" Color Scheme switch for linux
fu! ToggleLinuxColors()
if exists('base16colorspace') && base16colorspace == "256"
let s:base16colorspace = "mac"
else
let s:base16colorspace = 256
endif
exec "colorscheme base16-default"
endfu
$: time ruby cross_join.rb group_1.txt group_2.txt
a1d826a157c20ed6cb3d20292d5bc5b4, a1d826a157c20ed6cb3d20292d5bc5b4
real 6948m15.378s
user 6849m3.990s
sys 80m35.040s
$: time ruby hash_join.rb group_1.txt group_2.txt 100
a1d826a157c20ed6cb3d20292d5bc5b4, a1d826a157c20ed6cb3d20292d5bc5b4
Red/Black Tree implementation in GO
1- Write the tree.Add(int) function
2- Write a red black tree validator
- check if root is black
- check if the number of black nodes from the root to every nil is the same
- check that there are no two consecutive red nodes
3- Write the tree.Contains(int) function
# Helps you migrate from attachment_fu
# put it in your /lib dir and include it your xxxx_uploader.rb
module UploaderFu
def partition_dir
("%08d" % model.id).scan(/\d{4}/).join("/")
end
def model_dir
"#{model.class.to_s.underscore}/#{mounted_as}/"
std::list<int> list;
std::list<int>::iterator pos;
pos = list.begin();
list.insert(it, 1024);
pos = std::find(list.begin(), list.end(), 1024);
*pos; // get
@kirkconnell
kirkconnell / binary.rb
Last active December 15, 2015 17:49
Data Structure Skillboost exercises
## SOLUTION
def binary(value, data, low, high)
center = low + (high - low) / 2 # C
if center < low # C
nil # C
elsif data[center] == value # C
center # C
elsif data[center] > value # C
binary(value, data, low, center - 1) # T(n/2) + C
@kirkconnell
kirkconnell / gist:2572352
Created May 1, 2012 23:30
Liquid Template to test fb liquid drops
<ul>
<li>
User Locale: {{ fb.user.locale }}
</li>
<li>
User Country: {{ fb.user.country }}
</li>
<li>
Min Age: {{ fb.user.age.min }}
</li>
@kirkconnell
kirkconnell / gist:1879458
Created February 21, 2012 22:26
Widget Output
<script src='http://fronts.dev/assets/javascripts/widget/bail-calc.js' type='text/javascript'></script> <div id='bail-widget-container' data-attr='[{"maxValue":"1000","percentage":"10"},{"maxValue":"15000","percentage":"15"}]' data-phone='123-456-7890'> Bail Bonds calculator by <a id='ab_link' href='http://www.aboutbail.com/'>AboutBail</a>. </div>