Skip to content

Instantly share code, notes, and snippets.

@curiouslychase
curiouslychase / Gruntfile.js
Last active March 19, 2016 07:06
Grunt Up & Running from Using Grunt For A Better Workflow.
'use strict';
var packagejson = require('./package.json');
module.exports = function (grunt) {
// Configuration
grunt.initConfig({
pkg: packagejson,
watch: {
scripts: {
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Solution</title>
<link rel="stylesheet" href="css/style.css">
<link rel="author" href="humans.txt">
</head>
@curiouslychase
curiouslychase / reverso.py
Last active December 26, 2015 06:59
[python response] Here's the solution I came up with for this interview question on interviewcake.com: "Write a function to reverse a string in place. 'In place' means 'without creating a new string in memory.'" http://www.interviewcake.com/question/reverse-string-in-place
import sys
def reverso(str):
i = 0
str_len = len(str) - 1
str = list(str)
half_len = len(str)/2
for x in str:
temp = x
@curiouslychase
curiouslychase / reverso.rb
Last active December 25, 2015 19:59
Here's the solution I came up with for this interview question on interviewcake.com: "Write a function to reverse a string in place. 'In place' means 'without creating a new string in memory.'" http://www.interviewcake.com/question/reverse-string-in-place
# `ruby reverso.rb "foo"`
class Reverso
def initialize
my_arr = ARGV[0].split("")
puts "'#{self.reverso(my_arr)}'"
end
def reverso my_arr
len = my_arr.size - 1
halflen = ((len + 1)/2.0).ceil
@curiouslychase
curiouslychase / parenthetical-solution.js
Last active December 25, 2015 16:49
Here's the solution I came up with for this interview question on interviewcake.com: "I like parentheticals (a lot). "Sometimes (when I nest them (my parentheticals) too much (like this (and this))) they get confusing." Write a function that, given a sentence like the above, along with the position of an opening parenthesis, finds the correspond…
// I enjoy doing interview questions just because they make my brain feel better.
// Here's the solution I came up with for this interview question on interviewcake.com
// http://www.interviewcake.com/question/matching-parens
var str = 'Sometimes (when I nest them (my parentheticals) too much (like this (and this))) they get confusing.';
findMyMate(str, '(', ')', 10);
/**
* Find the mate of a given character
@curiouslychase
curiouslychase / index.html
Last active December 21, 2015 13:29
Hacky Type To For a Hackathon Project
<!DOCTYPE html>
<html>
<head>
<title>TypeTo</title>
<link href='http://fonts.googleapis.com/css?family=Shadows+Into+Light' rel='stylesheet' type='text/css'>
<style type="text/css">
input, div {
font-size: 36px;
font-weight: bold;
}
@curiouslychase
curiouslychase / toggle_hidden_files_in_finder
Created August 15, 2013 16:44
Toggle your hidden files in finder by runnning `finderHideTogg` in terminal.
function finderHideTogg() {
if [ `defaults read com.apple.finder AppleShowAllFiles` == true ]; then
`defaults write com.apple.finder AppleShowAllFiles false`;
else
`defaults write com.apple.finder AppleShowAllFiles true`;
fi
`killall Finder`;
}
@curiouslychase
curiouslychase / git_diff_file.diff
Last active December 21, 2015 02:09
Requirements: - Must have an exports jira='http://my.jira.url' - must be on a branch that's not master
# $1 : remote name you want to diff against
function gdf () {
# get the current branch reference, cut with the delimiter /
# and grab the 3rd item in the list, copy to the pastebord, use the pbpaste
# as the diff name.
current_branch=`git symbolic-ref HEAD | cut -d"/" -f 3`;
git diff $1/master...HEAD --relative > ~/difflog/$current_branch.diff;
open "$jira/$current_branch";
}
@curiouslychase
curiouslychase / .editorconfig
Created August 13, 2013 21:28
Editor config for http://editorconfig.org/ for my team.
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = "utf-8"
trim_trailing_whitespace = true
@curiouslychase
curiouslychase / commit-msg
Created August 13, 2013 20:35 — forked from anonymous/commit-msg
Place this in the following path relative to your git repo's root: .git/hooks/commit-msg
#!/usr/bin/env ruby
# Hook into the message and append the branch name so that we don't have to
# manually do it ourselves!
# This is the message that you put when you do:
# `git commit -m "This is my message"
message_file = ARGV[0]
message = File.read(message_file).strip
branch_name = `git rev-parse --abbrev-ref HEAD`.strip