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
| def calculate_bmi(weight_in_pounds, height_in_inches) | |
| return ((weight_in_pounds.to_f/height_in_inches.to_f**2) * 703) | |
| end |
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
| Boot file system in single user mode: hold down Command-S immediately after the startup tone. | |
| Make the file system read-write: /sbin/mount -uw / | |
| Delete the contents of three directories: | |
| rm -rf /Library/Caches/* | |
| rm -rf /System/Library/Caches/* | |
| rm -rf /Users/<username>/Library/Caches/* | |
| Be very careful about the rm -rf command! |
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
| var REFLOW = (function(window, $){ | |
| var self = {}; | |
| var nth; | |
| var itemsAfterFirstRow; | |
| var allItems = $('#items .col'); | |
| self.init = function(){ | |
| self.adjustHeights(); | |
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
| # This script uses the Plos.org API to collect article data. | |
| # Necessary libraries | |
| require 'csv' | |
| require 'work_queue' | |
| require 'rest-client' | |
| # The file name for the CSV file that will be READ | |
| CSV_FILENAME = "9_10_2014-Cumulative-Report-With-Subject-Area-and-Article-Type.csv" | |
| # The file name for the CSV file that will be WRITTEN | |
| CSV_OUTPUT_FILENAME = "9_10_2014-Cumulative-Report-With-ALM-Data.csv" |
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
| # This script scrapes the PlosOne.org website to extract data for articles. At the time, this data was not available in the API. | |
| # Necessary libraries | |
| require 'CSV' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'work_queue' | |
| require 'benchmark' | |
| CSV_FILENAME = "9_10_2014-Cumulative-Report.csv" |
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(document.body).on("mouseup", function(){ console.time("Tab showing") }); | |
| jQuery(".nav-tabs li:nth-child(1)").on("mouseup", function(){ console.timeEnd("Tab showing"); }) | |
| var target = document.querySelector(".nav-tabs li:nth-child(2)"); | |
| var observer = new MutationObserver(function(mutations) { | |
| mutations.forEach(function(mutation) { | |
| console.timeEnd("Tab showing"); | |
| }); | |
| }); |
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
| <a href="#nogo" class="button--PRIMARY">Primary Button</a> | |
| <br /> | |
| <a href="#nogo" class="button--SECONDARY">Secondary button</a> |
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
| var prices = document.querySelectorAll('[class*="color-price a-text-bold"]'); | |
| prices = Array.prototype.slice.call(prices); | |
| var total = 0; | |
| prices.forEach(function (price) { | |
| total += parseFloat(price.textContent.replace('$', '')); | |
| }); | |
| alert(total); |
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
| /** | |
| * Diff Java resource bundles to find missing keys. | |
| */ | |
| var fs = require('fs'); | |
| var englishFile = 'path/to/ResourceBundleMessage.properties'; | |
| var germanFile = 'path/to/ResourceBundleMessage_de.properties'; | |
| var japaneseFile = 'path/to/ResourceBundleMessage_ja.properties'; | |
| var chineseFile = 'path/to/ResourceBundleMessage_zh_CN.properties'; |
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
| # Aliases | |
| alias editprofile="nano ~/.bash_profile" | |
| alias loadprofile="source ~/.bash_profile" | |
| alias flushdns="sudo discovery udnsflushcaches" | |
| alias pythonserver="python -m SimpleHTTPServer 8000" | |
| alias mochatest="mocha test/setup.js --compilers js:babel-core/register --require ignore-styles " | |
| alias setprod="export NODE_ENV=production" | |
| alias setdev="unset NODE_ENV" | |
| alias checkenv="echo \$NODE_ENV" | |
| alias disableipv6="networksetup -setv6off Wi-Fi" |