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
[ | |
{'city': 'Abbeville', 'state': 'Louisiana'}, | |
{'city': 'Aberdeen', 'state': 'Maryland'}, | |
{'city': 'Aberdeen', 'state': 'Mississippi'}, | |
{'city': 'Aberdeen', 'state': 'South Dakota'}, | |
{'city': 'Aberdeen', 'state': 'Washington'}, | |
{'city': 'Abilene', 'state': 'Texas'}, | |
{'city': 'Abilene', 'state': 'Kansas'}, |
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
//data from https://en.wikipedia.org/wiki/List_of_European_cities_by_population_within_city_limits | |
//The script | |
function runIt() { | |
var table = document.getElementsByClassName('wikitable sortable jquery-tablesorter')[0] | |
var cities = [] | |
for (var i = 0, row; row = table.rows[i]; i++) { | |
if(i == 0) continue | |
//iterate through rows | |
//rows would be accessed using the "row" variable assigned in the for loop | |
var city = {} |
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
public class PhotoScalerAndSaver { | |
public static main(String[] args) { | |
//TODO: create your photo here | |
//Convert your photo to a bitmap | |
Bitmap photoBm = (Bitmap) "your Bitmap image"; | |
//scale and save the photo to a file on the directory | |
saveScaledPhotoToFile(Bitmap photoBm) |
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
(function() { | |
if (window.console.document) { | |
return | |
} | |
window.console.document = function() { | |
const args = Array.prototype.slice.call(arguments) | |
window.document.body.innerHTML = `<div id="__window_console_document__" style="padding:20px; font-size:20px; color: black">${args.join(' ')}</div>` | |
} | |
}()) |
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
Schema.statics._countByQuery = function(query) { | |
if(!query) { | |
throw new Error("query object is required") | |
} | |
return this.count(query) | |
.fail((err) => { | |
console.warn(err.message) | |
return Q.resolve(null) | |
}) |
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
function extractAllMentionedUsernames(str) { | |
var pattern = /\B@[a-z0-9_-]+/gi; | |
var arr = str.match(pattern) || [] | |
return arr.map((u) => u.replace('@', '')) | |
} | |
// if str = '@lwdthe1 are you @lincoln_w_daniel?' | |
// extractAllMentionedUsernames(str) => ['lwdthe1', 'lincoln_w_daniel'] |
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
// example html: <p parse-entities data-parse-entities-url="_blank" data-parse-entities-mentions="true" ng-model="message.text"></p> | |
angularApp | |
.directive('parseEntities', function () { | |
var mentionPattern = /\B@[a-z0-9_-]+/gi; | |
var urlPattern = /[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/gi; | |
const VALID_ANCHOR_TARGETS = {'_self': '_self', '_blank': '_blank'} | |
VALID_ANCHOR_TARGETS['self'] = VALID_ANCHOR_TARGETS['_self'] | |
VALID_ANCHOR_TARGETS['blank'] = VALID_ANCHOR_TARGETS['_blank'] | |
return { |
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
function convertCase(s, toDelim) { | |
if (!s || !s.length) return s | |
var existingType, lastFoundDelim = -1, camelCaseIndex = {} | |
if(s.indexOf(' ') > -1) existingType = ' '; | |
if(s.indexOf('-') > -1) existingType = '-'; | |
if(s.indexOf('_') > -1) existingType = '_'; | |
if(s.indexOf('.') > -1) existingType = '.'; | |
if(!existingType) { | |
for(var i = 0; i < s.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
function run378268() { | |
var xcczxc = document.getElementsByClassName('col-list-checkbox') | |
for (var i = 0; i < xcczxc.length; i++) { | |
if(xcczxc[i].clicked == true) continue | |
xcczxc[i].click() | |
xcczxc[i].clicked = true | |
} | |
window.scroll(0,500) | |
} | |
var run378268Interval = setInterval(() => { |
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
function copyTextToClipboard(text) { | |
var textArea = document.createElement("textarea"); | |
// | |
// *** This styling is an extra step which is likely not required. *** | |
// | |
// Why is it here? To ensure: | |
// 1. the element is able to have focus and selection. | |
// 2. if element was to flash render it has minimal visual impact. | |
// 3. less flakyness with selection and copying which **might** occur if |
NewerOlder