Skip to content

Instantly share code, notes, and snippets.

@marioflores
marioflores / jQuery-sample-ajax
Created June 13, 2013 02:29
Sample ajax call with jQuery
$.ajax({
url: "ajax.txt",
cache: false,
success: function(html){
console.log(html);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
});
@marioflores
marioflores / new_gist_file
Created June 28, 2013 00:56
Empty jQuery Function
$(function() {
//enter items here
});
@marioflores
marioflores / new_gist_file
Created June 28, 2013 00:57
Example onclick jQuery
$("#slideToggle").click(function () {
$('#slideTogglebox').slideToggle();
});
@marioflores
marioflores / new_gist_file
Created July 5, 2013 20:29
Diff two files
diff file1 file2
@marioflores
marioflores / new_gist_file
Created July 5, 2013 20:30
Diff Directories
diff -rq folder-1 folder-2
@marioflores
marioflores / new_gist_file
Created July 8, 2013 17:37
View local Mac mail
mail
To delete mail - ex. delete 1-12
Quit - q
@marioflores
marioflores / new_gist_file
Created July 11, 2013 11:33
Perfect Ajax request
$.ajax({
type: 'POST',
url: 'http://kyleschaeffer.com/feed/',
data: { postVar1: 'theValue1', postVar2: 'theValue2' },
beforeSend:function(){
// this is where we append a loading image
$('#ajax-panel').html('<div class="loading"><img src="/images/loading.gif" alt="Loading..." /></div>');
},
success:function(data){
// successful request; do something with the data
@marioflores
marioflores / new_gist_file
Created July 31, 2013 15:00
Restore files with Git
If the deletion has not been committed, the command below will restore the deleted file in the working tree.
$ git checkout -- <file>
You can get a list of all the deleted files in the working tree using the command below.
$ git ls-files --deleted
If the deletion has been committed, find the commit where it happened, then recover the file from this commit.
$ git rev-list -n 1 HEAD -- <file>
$ git checkout <commit>^ -- <file>
@marioflores
marioflores / new_gist_file
Created July 31, 2013 15:57
Checkout current branch
git checkout master
@marioflores
marioflores / Copy command line results to clipboard
Created August 9, 2013 15:55
Copy command line results to clipboard
ex. dir | clip