I have decided to stop using WordPress and move completely over to Gists and Google+. Whenever I want to make a post about code, I'll post it to Gist. Whenever I want to make another kind of post, I'll post it to Google+ with the hashtag #blogpost. Doing this will make life easier and I wont have to manage a CMS like WordPress or anything. It'll be great :) So what are you waiting for? Go ahead and read my Gist Blog and checkout my Google+ Blog Posts :)
This file contains 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
package com.kentcdodds.gmailretriever.main; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.util.Date; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Map; |
This file contains 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 isValidInt = function(str) { | |
var regex = /^\d+$/; | |
return regex.test(str); | |
}; |
This file contains 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
#Set a new remote origin url | |
git remote set-url origin git://new.url.here | |
#Add an alternate remote: | |
git remote add <remote-name> <url> | |
#Make the server look just like local | |
git push -f <remote> <branch> | |
#Make local look just like the server |
This file contains 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 centerElement = function ($element) { | |
$element.css("position","absolute"); | |
$element.css("top", Math.max(0, (($(window).height() - $($element).outerHeight()) / 2) + $(window).scrollTop()) + "px"); | |
$element.css("left", Math.max(0, (($(window).width() - $($element).outerWidth()) / 2) + $(window).scrollLeft()) + "px"); | |
return $element; | |
} | |
/* | |
Invoke this like this: | |
$(window).resize(function() { |
This file contains 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 capitaliseFirstLetter = function(string) { | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
}; | |
/* | |
* Detect IE. From http://stackoverflow.com/a/16657946 | |
* ---------------------------------------------------------- | |
* If you're not in IE (or IE version is less than 5) then: | |
* ie === undefined | |
* If you're in IE (>=5) then you can determine which version: |
This file contains 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
/************************************************ | |
* Execute commands | |
************************************************ | |
*/ | |
private String executeCommand(ChannelExec channel, String... commands) | |
throws IOException, JSchException { | |
InputStream in = channel.getInputStream(); | |
StringBuilder output = new StringBuilder(); | |
for (int i = 0; i < commands.length; i++) { |
This file contains 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
/** | |
* Simulates javascript's .join function. | |
*/ | |
public static String combine(String glue, String... stringsToCombine) { | |
int arryLength = stringsToCombine.length; | |
if (arryLength == 0) { | |
return null; | |
} | |
StringBuilder out = new StringBuilder(); |
This has been moved to an official Git repository
OlderNewer