Skip to content

Instantly share code, notes, and snippets.

<!--[if IE]> <html class="ie-any"> <![endif]-->
<!--[if !IE]><!--><html> <!--<![endif]-->
<script>
if(Function('/*@cc_on return typeof(document.documentMode)=="number" @*/')()){
document.getElementsByTagName("html")[0].className+=" ie-any";
}
</script>

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

ProcessDocument = app.trustedFunction(function () {
app.beginPriv();
var newDoc = app.newDoc();
var p = app.response("Start with page(default 0 - process all pages)?", "Query", "0");
var startFrom = parseInt(p) || 0;
var i = 0;
while (i < this.numPages) {
newDoc.insertPages({
nPage: newDoc.numPages - 1,
@altmind
altmind / sample-changelog.groovy
Created August 15, 2012 09:58
sample-changelog.groovy
databaseChangeLog = {
changeSet(author: "alt (generated)", id: "1345021906578-1") {
renameTable(oldTableName: "ADMINS", newTableName: "USERS")
}
}
@altmind
altmind / cloudfront-createDistribution-correct.groovy
Created August 13, 2012 16:23
cloudfront-createDistribution-correct
CreateDistributionResult distribution = cloudFrontClient.createDistribution(
new CreateDistributionRequest().withDistributionConfig(
new DistributionConfig()
.withCallerReference(System.nanoTime().toString())
.withAliases(
new Aliases()
.withQuantity(0)
)
.withDefaultRootObject("index.html")
.withOrigins(
@altmind
altmind / cloudfront-listdistributions.groovy
Created August 13, 2012 16:19
cloudfront-listdistributions
ListDistributionsResult distributions = cloudFrontClient.listDistributions(new ListDistributionsRequest().withMaxItems("1000"))
List<DistributionSummary> distributionsItems = distributions.distributionList.items
GetDistributionResult distribution = cloudFrontClient.getDistribution(new GetDistributionRequest().withId(distributionsItems[1].id))
@altmind
altmind / cloudfront-createDistribution.groovy
Created August 13, 2012 16:13
cloudfront createDistribution
CreateDistributionResult distribution = cloudFrontClient.createDistribution(
new CreateDistributionRequest().withDistributionConfig(
new DistributionConfig()
.withCallerReference(System.nanoTime().toString())
.withAliases(
new Aliases()
.withQuantity(0)
)
.withDefaultRootObject("index.html")
.withOrigins(
class Employee {
String firstName, lastName
Employee(firstName, lastName){
this.firstName=firstName
this.lastName=lastName
}
}
..
<!doctype html public>
<!--[if lt IE 7]> <html lang="en-us" id="home_page" class="no-js lt-ie9 lt-ie8 lt-ie7 liquid1000"> <![endif]-->
<!--[if IE 7]> <html lang="en-us" id="home_page" class="no-js lt-ie9 lt-ie8 liquid1000"> <![endif]-->
<!--[if IE 8]> <html lang="en-us" id="home_page" class="no-js lt-ie9 liquid1000"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en-us" id="home_page" class="no-js liquid1000"> <!--<![endif]-->
....
@altmind
altmind / jquery.color.blink.html
Created June 5, 2012 07:45
jquery color blinking