Skip to content

Instantly share code, notes, and snippets.

View lyle's full-sized avatar

Lyle Troxell lyle

View GitHub Profile
<html><body>Drag Bookmark "<a href='javascript:c=[];m=Math;d=document;q="querySelectorAll";d[q](".contrib-legend li").forEach(li=>{c.push(li.style.backgroundColor)});d[q]("g rect").forEach(i=>{i.setAttribute("fill",c[m.floor(m.random()*m.floor(c.length-1)+1)])});'>1337 Coder</a>" to bookmark bar.
Then visit your github profile and click that bookmark!
</body></html>
@lyle
lyle / test.html
Last active December 21, 2015 20:18
<html>
<head>
<script>
alert($4d.Method2;)
</script>
</head>
</html>
@lyle
lyle / index.js
Last active December 20, 2015 18:28
A node server that will delay it's response by 1000 milliseconds, or ?delay=milliseconds
var url = require('url');
var http = require('http');
http.createServer(function (req, res) {
var startTime = Date.now();
var delay = url.parse(req.url, true).query.delay || 1000;
setTimeout(function(){
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('We tried to delay your request by '.concat(
delay,
' milliseconds.\n',
@lyle
lyle / arrayLengthTest.js
Created May 13, 2013 22:14
Testing speed on Arrays in JS client side - I was curious if calling instanceOfArray.length was slower then referencing an intager.
var smallArray = [4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,5,6,7,8,9,4,22,3,5,4,
@lyle
lyle / index.html
Last active December 15, 2015 09:49
Bookmarklet for Pretty Printing a JSON api return
<html><body>
Drag this link <a href="javascript:function%20output(inp)%20{document.head.appendChild(document.createElement(%27style%27)).innerHTML%20=%20%22.string%20{%20color:%20green;%20}%20.number%20{%20color:%20darkorange;%20}%20.boolean%20{%20color:%20blue;%20}%20.null%20{%20color:%20magenta;%20}%20.key%20{%20color:%20red;%20}%22;document.body.innerHTML%20=%20%22<pre>%22%20+%20inp%20+%20%22</pre>%22;};function%20syntaxHighlight(json)%20{json%20=%20json.replace(/&/g,%20%27&amp;%27).replace(/</g,%20%27&lt;%27).replace(/>/g,%20%27&gt;%27);return%20json.replace(/(%22(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\%22])*%22(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,%20function%20(match)%20{var%20cls%20=%20%27number%27;if%20(/^%22/.test(match))%20{if%20(/:$/.test(match))%20{cls%20=%20%27key%27;}%20else%20{cls%20=%20%27string%27;}}%20else%20if%20(/true|false/.test(match))%20{cls%20=%20%27boolean%27;}%20else%20if%20(/null/.test(match))%20{cls%20=%20%27null%27;}return%20%27<span%20class=%22%27%20+%20cls%20+
@lyle
lyle / gist:5068912
Created March 2, 2013 00:00
Alba Server
AMD Dual-Core Opteron 180 - OSA180DAA6CD (OSA180CDBOX)
@lyle
lyle / BootstrapNotes.md
Created March 1, 2013 06:03
Web Deve, Bootstrap and Less
@lyle
lyle / active_admin.rb
Created October 9, 2012 07:08 — forked from fred/active_admin.rb
extend active admin to prettier boolean values
# It extends activeadmin to show pretty boolean values
#
# config/initializers/active_admin.rb
module ActiveAdmin
module Views
class TableFor
def bool_column(attribute)
column(attribute){ |model| model[attribute] ? '&#x2714;'.html_safe : '&#x2717;'.html_safe }
end
# remove unused files
remove_file "README"
remove_file "public/index.html"
remove_file "public/images/rails.png"
remove_file "app/views/layouts/application.html.erb"
remove_file "public/javascripts/controls.js"
remove_file "public/javascripts/dragdrop.js"
remove_file "public/javascripts/effects.js"
remove_file "public/javascripts/prototype.js"
remove_file "public/javascripts/rails.js"
@lyle
lyle / gist:67051
Created February 19, 2009 19:02 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
# inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"