Skip to content

Instantly share code, notes, and snippets.

@tb0yd
tb0yd / GHOpenAllExpanders.js
Created June 19, 2017 14:25
GHOpenAllExpanders.js
function simulateClick(el){
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
el.dispatchEvent(evt);
}
function clickAllExpanders() {
var els = document.getElementsByClassName('diff-expander');
for(var i = 0; i < els.length; i++) {
simulateClick(els[i]);
@tb0yd
tb0yd / index.html
Last active June 6, 2016 18:41 — forked from tristen/index.html
Swap baselayer with a persistent data layer on top
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.15.0/mapbox-gl.css' rel='stylesheet' />
<script src='//d3js.org/d3.v3.min.js' charset='utf-8'></script>
</head>
@tb0yd
tb0yd / fsr.md
Last active October 29, 2015 15:34
Full Stack Redux

Here are my thoughts on the problem. Basically we should add another store to represent the database. The database "store" has its own actions that don't render components, but just call other actions (like "render new data" or "render error message" or "try again").

screen shot 2015-10-29 at 11 08 35 am

Blue: stores
Yellow: components
Green: reducers
Red: actions
diff --git a/bottles/lib/bottle_number.rb b/bottles/lib/bottle_number.rb
new file mode 100644
index 0000000..fb1602b
--- /dev/null
+++ b/bottles/lib/bottle_number.rb
@@ -0,0 +1,43 @@
+class BottleNumber
+ attr_accessor :num
+
+ def initialize(num)
function clearShoppingCart() {
var uls = document.getElementsByTagName("UL");
uls[0].innerHTML = "";
var totl = document.getElementById("totl");
totl.innerHTML = "$0.00";
};
class JavascriptEraser
def initialize(app)
@app = app
end
def call(env)
status, headers, response = @app.call(env)
if headers['Content-Type'] and headers['Content-Type'].include?("javascript")
response = ""
Parameters: {"commit"=>"Save", "authenticity_token"=>"0J2KJTdPMJoigiRL8gS8PP6DMJsK5E8ZmZPrMh/7I6s=", "id"=>"3", "job_post"=>{"travel_time"=>"25_percent", "education_level"=>"some_high_school", "title"=>"blah", "career_level"=>"any", "preferred_skills"=>[{"name"=>"Test2", "level"=>"intermediate"}], "job_function"=>"construction_skill_trades", "address_attributes"=>{"city"=>"Gastonia", "postal_code"=>"22222", "country"=>"united_states", "id"=>"7", "state"=>"arkansas"}, "job_type"=>"full-time", "summary"=>"blah", "description"=>"blah", "expires_on(1i)"=>"2013", "requisition_no"=>"22", "expires_on(2i)"=>"5", "duration"=>"1", "expires_on(3i)"=>"3"}}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type="text/javascript">
//<![CDATA[
try {
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
{:company_size=>"200-500",
:creator=>
#<User id: 7525, email: "user10@example.com", encrypted_password: "c017333d5105b87a8429648fd79233c2f0cc72ed", salt: "4c651fe5fab9102852419445f5b54282d583dcd2", token: "df6eddf5af9082b8eb9a93ecf998de24fcd186e3", token_expires_at: nil, email_confirmed: false>,
:name=>"",
:description=>"This is a great description.",
:company_type=>"Private",
:vision=>"I see the light!"}
expected the following element's content to include "error":
Protopipe
Company successfully updated.
Name:
Company Size:
200-500
Company Type:
Private
Description:
This is a great description.