Skip to content

Instantly share code, notes, and snippets.

@sdthornton
sdthornton / update-in.js
Created January 11, 2024 04:29
update-in
function updateIn() {
let tr = $('td:contains("240112"), td:contains("240113"), td:contains("240114"), td:contains("240115")').parents('tr');
let td = tr && tr.find('td:contains("$4")')[0];
if (!window.hasUpdatedIns && tr && td) {
let price = td.innerText;
let newPrice = parseFloat(price.replace(/\$|,/gi, "")) - 85.76;
let [dollars, cents] = newPrice.toFixed(2).split(".");
td.innerText = "$" + Number(dollars).toLocaleString() + "." + cents;
window.hasUpdatedIns = true;
}
@sdthornton
sdthornton / CssStyleGuide.md
Created August 4, 2022 19:14
Genuity CSS Style Guide (somewhat outdated, but still useful)
class Steven::Rocks
def self.get_icon(appkey, token)
# Set temp path
path = "/tmp/submit/_icons"
# Create temp directory if it doesn't exist
if !File.directory?(path)
FileUtils.mkdir_p(path)
end

When it comes to IT, the less you know, the more you pay.

As far reaching and prominent as the benefits of technology are, the IT market is still shrouded in complexity, exclusivity, and confusion. This is no accident. Technology companies profit by keeping their products complex.

Small and medium-sized businesses (SMBs) are working hard every day to stay competitive and grow their business, but they don’t get to enjoy the efficiencies and support achieved by technologies that larger companies can afford. What is available for SMBs are expensive and complex solutions with little support.

Company IT decision-makers may be experts in their field, but everyone needs help choosing the right solution for to meet the needs of that business. In the IT market this is the status quo; it is a classic case of the asymmetry of information. The party with fewer resources gets the worse deal.

So, how do you change the status-quo? Another SaaS app? A new marketplace? When built to serve individual companies these produc

@sdthornton
sdthornton / keybase.md
Created January 9, 2019 16:38
Keybase Proof

Keybase proof

I hereby claim:

  • I am sdthornton on github.
  • I am sthornton (https://keybase.io/sthornton) on keybase.
  • I have a public key ASCKjUAIUQsGW2ZV1-nuwLVEYBfW_y6JW0DOY6QkTaqG0wo

To claim this, I am signing this object:

@sdthornton
sdthornton / mixins.scss
Last active August 28, 2015 22:28
SASS transform mixin with fallback for IE9.
@function str-replace($string, $search, $replace: '') {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@mixin transform($trans...) {
$fallback: unquote(str-replace(str-replace("#{$trans}", '3d', ''), ', 0)', ')'));
@sdthornton
sdthornton / add_url_params.js
Last active August 29, 2015 14:16
Add URL params to a page with pushState
// Simply pass in the params you want as an object, e.g. addURLParams({ foo: 'bar' })
var addURLParams = function(newParams) {
if (!newParams || typeof(newParams) !== 'object') {
return false;
}
var extend = function(out) {
out = out || {};
for (var i = 1; i < arguments.length; i++) {
@sdthornton
sdthornton / jquery.request_scroll.js.coffee
Last active January 7, 2020 18:44
jQuery wrapped function for lovely debounced scroll events (using requestAnimationFrame).
# jQuery wrapped function for lovely debounced scroll events (using requestAnimationFrame)
# Works on IE9+
jQuery.requestScroll = (callback) ->
data = window.scrollRequestsData ||= {}
requests = data.requests ||= {}
# Ideally, using multiple instances prevents conflicts between ticking
# It also allows for an easy way to remove the specific scroll event
# This performance is still being investigated
scrollInstanceNum = Object.keys(requests).length + 1
@sdthornton
sdthornton / delete_from_github.sh
Created January 20, 2015 20:42
Delete a branch locally and from Github
function delete_from_github() {
log=$(git log origin/$1..$1 --oneline)
if [[ -z "${log}" ]]; then
git push origin :$1
git branch -D $1
elif [[ "${log}" == *"path not in the working tree"* ]]; then
echo -e "\033[0;31mIt doesn't appear that your branch exists remotely."
tput sgr0
while true; do
read -p "Are you sure you want to delete this branch? [y/n] `echo $'\n> '`" yn
@sdthornton
sdthornton / layout-demo.html
Created October 1, 2014 19:24
Column Layout Idea for Bespoke
<!-- Result: https://cloudup.com/iD68XYKVseY -->
<div class="column-parent">
<div class="column--8">
<div class="demo"></div>
</div>
<div class="column--4">
<div class="demo"></div>
</div>