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
These are some helpful Git resources that I found while climbing the learning curve. | |
Feel free to append / modify | |
======================= | |
== UNDERSTANDING GIT == | |
======================= | |
* The Git Parable | |
- http://tom.preston-werner.com/2009/05/19/the-git-parable.html | |
- "Read this parable all the way through and you should have very little trouble mastering the various Git commands and wielding the awesome power that Git makes available to you." |
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
# From http://railstips.org/blog/archives/2009/02/02/bedazzle-your-bash-prompt-with-git-info/ | |
# Add this on bashrc file | |
# Git branch display with color | |
function parse_git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "(ⓖ "${ref#refs/heads/}")" | |
} | |
BLUE="\[\033[1;34m\]" | |
RED="\[\033[0;31m\]" |
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
CREATE TABLE IF NOT EXISTS `continents` ( | |
`code` CHAR(2) NOT NULL COMMENT 'Continent code', | |
`name` VARCHAR(255), | |
PRIMARY KEY (`code`) | |
) ENGINE=InnoDB; | |
INSERT INTO `continents` VALUES | |
('AF', 'Africa'), | |
('AS', 'Asia'), | |
('EU', 'Europe'), |
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
import com.adobe.granite.xss.XSSAPI; | |
import org.apache.sling.api.resource.ResourceResolver; | |
public class UserComment { | |
public String getFilteredComment(ResourceResolver resourceResolver, String commentTxt) { | |
XSSAPI xssAPI = resourceResolver.adaptTo(XSSAPI.Class); | |
return xssAPI.getValidHref(commentTxt); | |
} | |
} |
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
<%@ include file="/libs/foundation/global.jsp" %> | |
<% | |
String siteTitle = request.getParameter("siteTitle"); | |
String websiteLink = request.getParameter("websiteLink"); | |
%> | |
<html> | |
<head> | |
<title> | |
<%= xssAPI.encodeForHTML(siteTitle); %> | |
</title> |
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
import java.util.*; | |
import org.apache.commons.collections4.Trie; | |
import org.apache.commons.collections4.trie.PatriciaTrie; | |
... | |
... | |
Map<String, BookInfo> library = new LinkedHashMap<>(); | |
/* Load your regualr map with data */ | |
library.put("To Kill a Mockingbird", new BookInfo("Harper Lee", "978-0061120084")); | |
libraby.put("Pride and Prejudice", new BookInfo("Jane Austen", "978-0679783268")); | |
libraby.put("To Kill A Warlock", new BookInfo("H.P. Mallory", "978-xxxxxxxx")); |
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
use myDB | |
db.createUser( | |
{ | |
user: "userName", | |
pwd: "abc123", | |
roles: ["readWrite"] | |
} | |
) |
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
db.myCollection.insert({name:"My Name", password : "abc"}) | |
db.myCollection.save({_id: "123", name:"My Name", password : "abc"}) | |
db.myCollection.update( | |
{"name" : "My Name" }, | |
{$set: { "password": "123" }} | |
) |
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
db.myCollection.find({ "name": "Manhattan" }) | |
db.myCollection.find({ "detail.age": 25 }) | |
db.myCollection.find({ "detail.age": { $lt: 60 }}) | |
db.myCollection.find({ $or: [{"name": "My Name"}, {"detail.age": 25 } ]}) |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |