This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Add this to the bottom of your .bashrc file and run source ~/.bashrc | |
#thanks to | |
#http://www.ibm.com/developerworks/linux/library/l-tip-prompt/ and | |
#http://martinfitzpatrick.name/article/add-git-branch-name-to-terminal-prompt-mac/ | |
# Git branch in prompt. | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically adds branch name to the end of every commit message. Handy for git/JIRA integrations. | |
# Make a copy of .git/hooks/prepare-commit-msg.sample in your repo and name the file prepare-commit-msg (remove "sample" extension) | |
# Paste the following into the file, save the file, and try it out in bash | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
echo $(cat "$1") "$NAME" > "$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.changeIngredient = function(index) { | |
if (index == $scope.formMeal.ingredients.length -1) { | |
$scope.formMeal.ingredients.push(''); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Ingredients</h2> | |
<ol class="ingredients-list"> | |
<!-- loop through and display existing ingredients --> | |
<li data-ng-repeat="ingredient in formMeal.ingredients track by $index"> | |
<textarea name="ingredientLines" | |
type="text" | |
data-ng-model="formMeal.ingredients[$index].name" | |
placeholder="Add ingredient" | |
data-ng-change="changeIngredient($index)" | |
></textarea> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add this to the bottom of your functions.php file | |
//Must be using Genesis framework for WordPress | |
//This code will change your category pages to contain a simple list of your post titles as links | |
add_action( 'pre_get_posts', 'mjg_show_titles_only_category_pages' ); | |
function mjg_show_titles_only_category_pages( $query ) { | |
if( $query->is_main_query() && $query->is_category() ) { | |
$query->set( 'orderby', 'title' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Welcome to Custom CSS! | |
CSS (Cascading Style Sheets) is a kind of code that tells the browser how | |
to render a web page. You may delete these comments and get started with | |
your customizations. | |
By default, your stylesheet will be loaded after the theme stylesheets, | |
which means that your rules can take precedence and override the theme CSS | |
rules. Just write here what you want to change, you don't need to copy all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Return to me the highest Fibonacci number under 100 | |
//0,1,1,2,3,5,8,13,21,34,55,89 | |
var maxNum = 100; | |
var sum = 0; | |
var findHighestFiboUnder = function(max, num1, num2) { | |
//allows num1 and num2 to be optional | |
num1 = typeof num1 !== 'undefined' ? num1: 1; | |
num2 = typeof num2 !== 'undefined' ? num2: 1; | |
sum = num1 + num2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Return to me the highest Fibonacci number between 0 and 100 | |
//1,2,3,5,8,13,21,34,55,89 | |
var sum = 0; | |
var arr = []; | |
var fibo = function(num1, num2) { | |
sum = num1 + num2; | |
console.log('num1: ' + num1 + ' + num2: ' + num2 + ' = sum: ' + sum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var str = ""; | |
var params = { | |
3:"fizz", | |
5:"buzz", | |
8:"chocolate" | |
}; | |
for (var i = 0; i < 100; i ++ ) { | |
str = i + " "; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
casper.test.begin("Testing if node express app", 2, function suite(test) { | |
casper.start('http://localhost:3000', function() { | |
test.assertHttpStatus(200); | |
}); | |
casper.then(function() { | |
if (this.fetchText('.daysLeft') > 0) { //todo: parse as int? | |
this.echo("more than 0 days left"); | |
} | |
this.echo("Days left: " + this.fetchText('.daysLeft')); |