This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
A simple algorithm, not the most efficient*, can be explained as: | |
Iterate through every element in the array; call the current one "outer": | |
For every element after "outer", Step through and compare to "outer" | |
If the difference is larger than previously compared, store the result. | |
At the end, show the largest difference. | |
I read up on a few more advanced algorithms that should be more efficient, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def firstchar_map(input) | |
return input.split.map(&:chr)*'' | |
end | |
puts firstchar("hello world") | |
puts firstchar("what you see is what you get") | |
# this is my very first ruby function, so here's where i learned from... | |
# - commenting: http://www.tutorialspoint.com/ruby/ruby_comments.htm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"result": [ | |
"ftp> Local directory now C:\\some\\virtual\\folder.", | |
"ftp> lcd c:\\some\\folder\\and\\directory", | |
"Connected to some.site.com.", | |
"open some.site.com", | |
"220 Microsoft FTP Service", | |
"User (some.site.com:(none)): ", | |
"331 Password required for some_user.", | |
"", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Language=JScript %> | |
<!--#include file="json.asp" --><%/* https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js */%> | |
<% | |
var ftp = (function() { | |
/* | |
* Copy a file(s) to a directory on a remote FTP server. | |
* | |
* Adapted from the very usefull post @ http://benmeg.com/code/asp/ftp.asp.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Language=JScript %> | |
<!--#include file="excel.asp" --><%/* https://gist.githubusercontent.com/patcullen/096a79ca8000b367537e/raw/7a806439bdf388335f2403ba89d8f51f039fb6a8/excel.asp */%> | |
<!--#include file="json.asp" --><%/* https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js */%> | |
<% | |
excelFile = "c:/temp/unlocodes.xlsx" | |
sql = "SELECT [ISO 3166-1], [Country Name] FROM [Sheet1$]" | |
excel.open(excelFile).query(sql, {}, function(codes) { | |
Response.write( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
var excel = (function () { | |
var connection = null; | |
function open(file) { | |
connection = Server.createObject('ADODB.Connection'); | |
connection.CommandTimeout = 60; | |
connection.CursorLocation = 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
ExcelFile = "c:\temp\unlocodes.xlsx" | |
SQL = "SELECT [ISO 3166-1], [Country Name] FROM [Sheet1$]" | |
Set ExcelConnection = Server.createobject("ADODB.Connection") | |
ExcelConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ExcelFile & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";" | |
SET RS = Server.CreateObject("ADODB.Recordset") | |
RS.Open SQL, ExcelConnection | |
Response.Write "<table border=""1""><thead><tr>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<script src="injectCSS.js"></script> | |
</head> | |
<body> | |
<div class="test case1">test case 1</div> | |
<div class="test case2">test case 2</div> | |
<script> | |
(function(){ | |
injectCSS(function(){/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['injectCSS'], function(injectCSS) { | |
injectCSS(function(){/* | |
.case1 { | |
border: 3px solid #0f0; | |
} | |
*/}); | |
injectCSS('.case2 { border: 3px solid #00f; } '); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Location:', '' + window.location); | |
console.log('Number of links:', document.querySelectorAll('a').length); | |
console.log('Number of _blank links:', document.querySelectorAll('a[target="_blank"]').length); | |
console.log('% of _blank links:', ~~( document.querySelectorAll('a[target="_blank"]').length / document.querySelectorAll('a').length * 100 ) ); |
NewerOlder