Skip to content

Instantly share code, notes, and snippets.

@kyletolle
kyletolle / filesDeleted.js
Created December 18, 2023 20:19
Github PR review: Snippet to check viewed on files renamed without changes or deleted
// In a GitHub PR, you can run this script in a console to help automatically click the Viewed checkbox
// Worked as of 2023.12.18
// JS snippet to click 'Viewed' on files that were deleted entirely, not changed or renamed
Array.from(document.querySelectorAll('.js-diff-load')).forEach(fileInfo => {
const text = fileInfo.nextElementSibling.textContent.trim();
if(text.includes('This file was deleted.')) {
const viewedCheckbox = fileInfo.closest('.js-file.js-details-container').querySelector('.js-reviewed-checkbox');
if(viewedCheckbox && !viewedCheckbox.checked) {
viewedCheckbox.click();
}
global.helloWorldText = 'Hello, world!';
helloWorld = function() {
console.log(global.helloWorldText);
return global.helloWorldText;
};
helloWorld();
@kyletolle
kyletolle / alias_method_matcher.rb
Last active January 19, 2016 21:02
RSpec alias_method matcher
# spec/support/matchers/alias_method_matcher.rb
# RSpec matcher for alias_method.
# Orignal idea borrowed from: https://gist.github.com/1950961
# Usage:
#
# describe Boomerang do
# let(:boomerang) { described_class.new }
# let(:subject} { boomerang }
# it { is_expected.to alias_method(:in_flight?).to(:in_air?) }
@kyletolle
kyletolle / fulcrum_project_example.json
Last active August 29, 2015 14:24
Fulcrum Project JSON Example
{
"project": {
"name": "Denver",
"description": "Data collected that is in the Denver, CO area.",
"id": "3bc943c3-6477-4010-a876-8e5fce61fdf1",
"created_at": "2014-05-07T19:17:42Z",
"updated_at": "2014-05-07T19:17:42Z"
}
}
@kyletolle
kyletolle / actual_output.html
Last active August 29, 2015 14:13
Multiline hidden field value's string padded in HAML
<!DOCTYPE html>
<html>
<head>
<title>HamlPlayground</title>
<link rel="stylesheet" media="all" href="/assets/scaffolds-07f6f551a374e3569370d2d26dba981d.css?body=1" data-turbolinks-track="true" />
<link rel="stylesheet" media="all" href="/assets/testers-069e88c06b889877799890854d7f4c40.css?body=1" data-turbolinks-track="true" />
<link rel="stylesheet" media="all" href="/assets/application-a6772d2c79915825e0baf618a303d51b.css?body=1" data-turbolinks-track="true" />
<script src="/assets/jquery-eb3e278249152b5b5d5170b73d9dbf52.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/jquery_ujs-0b8f09cf5aec4ba1be1abd9f915c77e2.js?body=1" data-turbolinks-track="true"></script>
<script src="/assets/turbolinks-924184401b7d116eadaaefc96895fa84.js?body=1" data-turbolinks-track="true"></script>
@kyletolle
kyletolle / index.html
Created January 15, 2015 21:10
Broken leaflet toolbar draw example with node_modules
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" type="text/css" href="node_modules/leaflet-draw/dist/leaflet.draw.css" />
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="node_modules/leaflet-toolbar/dist/Leaflet.Toolbar.css" />
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
@kyletolle
kyletolle / index.html
Created January 15, 2015 20:49
Leaflet toolbar drawing demo
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" type="text/css" href="leaflet.draw.css" />
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="leaflet.toolbar.css" />
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
@kyletolle
kyletolle / index.html
Last active August 29, 2015 14:13
Minimal Leaflet Page
<!DOCTYPE html>
<html>
<head>
<title>Minimal Leaflet Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<style>
html, body, #map { margin: 0; height: 100%; width: 100%; }
</style>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
@kyletolle
kyletolle / index.html
Last active August 29, 2015 14:13
Minimal HTML5 Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- For viewing the page on mobile devices -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Barebones HTML5</title>
<link rel="stylesheet" href="style.css">
<script src="application.js"></script>
</head>
@kyletolle
kyletolle / minimal_html5.html
Last active August 29, 2015 14:13
Minimal HTML5 Pages
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- For viewing the page on mobile devices -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Barebones HTML5</title>
<link rel="stylesheet" href="style.css">
<script src="application.js">
</head>