Skip to content

Instantly share code, notes, and snippets.

View kfarst's full-sized avatar

Kevin Farst kfarst

View GitHub Profile
@kfarst
kfarst / Dockerfile
Created April 11, 2018 22:28 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class Responder: NSObject {
@objc func segmentedControlValueChanged(_ sender: UISegmentedControl) {
UIView.animate(withDuration: 0.3) {
buttonBar.frame.origin.x = (segmentedControl.frame.width / CGFloat(segmentedControl.numberOfSegments)) * CGFloat(segmentedControl.selectedSegmentIndex)
}
function fizzBuzzCustom (fizz, buzz, firstDivisibility, secondDivisibility) {
var incrementedArray = [];
// Set to the argument or default to 'Fizz'
fizz = fizz || 'Fizz';
// Set to the argument or default to 'Buzz'
buzz = buzz || 'Buzz';
// Set to the argument or default to 3
function transposeTwoStrings (string1, string2) {
var i = 0
// Continue checking each letter of each string as long as at least one of the strings still has letters
while (string1[i] !== undefined || string2[i] !== undefined) {
var letterColumn = '';
// As long as the index we're at still has a letter, append it to the string, otherwise append an empty space
if (string1[i] !== undefined) {
letterColumn = letterColumn.concat(string1[i]);
function jadenCase (input) {
// Split the input into an array of individual words
var words = input.split(' ');
for (var i = 0; i < words.length; i++) {
// For each word take the first letter, captialize it, take the rest of the word, lowercase it,
// then re-assign the modified word to the current position in the array
words[i] = words[i].charAt(0).toUpperCase() + words[i].substr(1).toLowerCase();
}
// Join the array of words back together into a string separated by spaces
import java.io.*;
import java.util.*;
import org.junit.*;
import org.junit.runner.*;
public class Solution {
public static class PalindromeTester {
public boolean isPalindrome( final String input ) {
module Callable
def call(*args, &block)
new(*args).call(&block)
end
module WithLogging
def call(*args, &block)
with_logging(*args) do
new(*args).call(&block)
end
@kfarst
kfarst / isPalindrome.java
Created February 1, 2016 23:32
Thomas Java Palindrome Solution
import java.io.*;
import java.util.*;
class Solution {
private static boolean isPalindrome( final String input ) {
if(input.length()==0){
return false;
}
String intput2 = input.replace(" ","");
int length = intput2.length()-1;
@kfarst
kfarst / gist:3086828ce6a48093dc9f
Created March 21, 2015 02:02
Picker View Scale
pickerWidthScaleRatio = (self.view.frame.width / 2.0) / pickerNaturalWidth
pickerHeightScaleRatio = self.view.frame.height / pickerNaturalHeight
timePicker.transform = CGAffineTransformMakeScale(pickerWidthScaleRatio, pickerHeightScaleRatio)
zozi (kf: b2b-race-deal) ~ gem install therubyracer -v '0.11.4'
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/kfarst/.rvm/rubies/ruby-1.9.3-p545/bin/ruby -r ./siteconf20141023-59714-db82zv.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** extconf.rb failed ***