Skip to content

Instantly share code, notes, and snippets.

View api-cheatsheet-array.md

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array<T[] | T>): T[] 🔒 ES3
@straydogstudio
straydogstudio / gist:0541e83bc30abe2636fb
Last active Aug 29, 2015 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
View gist:0541e83bc30abe2636fb
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
View xlsx_test.rb
require 'axlsx'
title = "Some report"
selected_columns = %w(one two three four five)
Axlsx::Package.new do |package|
package.workbook do |workbook|
# Disabling this will improve performance for very large documents
workbook.use_autowidth = false
@straydogstudio
straydogstudio / README.txt
Last active Jan 6, 2021 — forked from flaviaza/README.txt
A jQuery fixed header table implementation. Designed to work with Bootstrap, but should work generally.
View README.txt
Here is a simple jQuery plugin to make a table header fixed on top of a div when this is scrolled.
Using the code from twitter bootstrap documentation page, this code is customized for table header.
Create the table with the table-fixed-header class and a thead tag:
<table class="table table-striped table-fixed-header" id="mytable">
<thead class="header">
<tr>
<th>Email Address</th>
<th>First Name</th>
<th>Last Name</th>
View gist:2926269
git push -f origin HEAD^:master
@straydogstudio
straydogstudio / gist:2926264
Created Jun 13, 2012
JavaScript: Sexy PubSub
View gist:2926264
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
@straydogstudio
straydogstudio / gist:2926239
Created Jun 13, 2012
CSS: Image Replacement
View gist:2926239
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@straydogstudio
straydogstudio / .pryrc
Created Jun 13, 2012 — forked from renz45/.pryrc
Pry: .pryrc configuraton
View .pryrc
#switch default editor for pry to sublime text
Pry.config.editor = "sublime"
#format prompt to be <Rails version>@<ruby version>(<object>)>
Pry.config.prompt = proc do |obj, level, _|
prompt = "\e[1;30m"
prompt << "#{Rails.version} @ " if defined?(Rails)
prompt << "#{RUBY_VERSION}"
"#{prompt} (#{obj})>\e[0m"
end