Skip to content

Instantly share code, notes, and snippets.

View kfarst's full-sized avatar

Kevin Farst kfarst

View GitHub Profile
target_email = '[email protected]' # Email of the person you are cloning the pitch site to
target_domain = 'crushpath' #subdomain of the user you are cloning the pitch site to
new_name = 'event-planning' #Name of the pitch site as needed by the user
copy_url = "http://crushpath.crushpath.me/djennifer/event-planning" #public url of the pitch site you are cloning from.
if target_domain.blank? || target_email.blank? || new_name.blank? || copy_url.blank?
puts "Required arguments:"
puts "\tsubdomain=acme - the subdomain for the target user"
puts "\[email protected] - the user being copied to"
puts "\tname=upside - the new vanity name"
puts "\tcopy_url=http://crushpath.crushpath.me/sam - full url of the site to copy"
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 ***
@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)
@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;
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
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 ) {
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
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 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
//: 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)
}