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
//jQuery.ajax - Success, error and complete are deprecated in jQuery 1.8 | |
function toListItem(element) { | |
return '<li>' + element + '</li>'; | |
} | |
var first = $.ajax({ | |
type: "GET", | |
url: "/items", | |
accepts: "text/json" | |
}); |
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
// Given an array, var arr = [1,2,3,4,5] how do you implement a function duplicator such that | |
// arr.duplicator() == [1,2,3,4,5,1,2,3,4,5]? | |
// Duplicate array elements by modifying array instead of assigning the returned array to a new var. | |
Array.prototype.duplicator = function(obj) { | |
this.map(duplicate); | |
}; | |
function duplicate(element, index, array){ | |
return array.push(element); |
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
// Given an array, var arr = [1,2,3,4,5] how do you implement a function duplicator such that | |
// arr.duplicator() == [1,2,3,4,5,1,2,3,4,5]? | |
Array.prototype.duplicator = function() { | |
return this.concat(this); | |
}; | |
var arr = [1,2,3,4,5], | |
dupe = arr.duplicator(); |
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
// Given an array ["foo", "bar", "baz"], | |
// return ["foo foo foo", "bar bar bar", "baz baz baz"] | |
var arr = ["foo", "bar", "baz"]; | |
function triple(element) { | |
return [element, element, element].join(" "); | |
} | |
arr.forEach(function() { |
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
import os, glob, shutil, sys | |
path = os.environ['LOCALAPPDATA'] + "/Google/Chrome/User Data/Default/Cache/" | |
listing = os.listdir(path) | |
for infile in listing: | |
if "f_" in infile: | |
abs_path = path + infile | |
statinfo = os.stat(abs_path) | |
if statinfo.st_size > 1000000: #checking to see if the file > 1MB |
NewerOlder