I hereby claim:
- I am sgonzalez on github.
- I am slgonzalez (https://keybase.io/slgonzalez) on keybase.
- I have a public key whose fingerprint is 016A 3792 861F 1320 0978 6E9A 3284 3BC5 A3AF 4AA2
To claim this, I am signing this object:
extension String { | |
func runAsZshCommandLine() -> String { | |
let task = Process() | |
task.launchPath = "/bin/zsh" | |
task.arguments = ["-l"] | |
let input = Pipe() | |
task.standardInput = input | |
input.fileHandleForWriting.write(self.data(using: .utf8)!) | |
input.fileHandleForWriting.closeFile() |
/////////////////////////////////////////// | |
// Santiago Gonzalez <slgonzalez@me.com> // | |
/////////////////////////////////////////// | |
#ifndef CONSTANTS_H | |
#define CONSTANTS_H | |
#include <math.h> |
/////////////////////// | |
// Santiago Gonzalez // | |
/////////////////////// | |
// Notes: | |
// - 2d arrays are assumed to be normal arrays with width*height elements (hence the ELEM macro) | |
// - Point is just a struct with an x and y | |
#define ELEM(arr, height, i, j) arr[i*height+j] |
I hereby claim:
To claim this, I am signing this object:
# put in application_helper.rb | |
def segmented_control(f, attribute, names, values, active_value) | |
haml_tag :div, :class => "btn-group", "data-toggle" => "buttons", style:"display:block; margin-bottom:50px;" do | |
values.each_with_index do |v, i| | |
haml_tag :label, :class => "btn btn-default#{active_value == v ? ' active' : ''}" do | |
haml_concat(f.radio_button attribute, values[i], :checked => (active_value == v)) | |
haml_concat names[i] | |
end | |
end | |
end |
#!/usr/bin/ruby | |
####################### | |
## Santiago Gonzalez ## | |
####################### | |
### | |
# This is a simple implementation of Welford's single pass equations in Ruby | |
# Calculates mean, max, min, count, stdev, variance, and autocorrelation | |
### |
#!/usr/bin/env ruby | |
####################### | |
## Santiago Gonzalez ## | |
####################### | |
# Bernoulli(p) | |
# Binomial(n, p) | |
# Equilikely(a, b) | |
# Geometric(p) |
(15 - anything.to_s.length).times { anything = "0#{anything}" } #add leading zeros, where 15 is the total wanted length |