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
import Foundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
let credential = URLCredential(user: “[email protected]”, password: “password”, persistence: URLCredential.Persistence.forSession) | |
let protectionSpace = URLProtectionSpace(host: "example.com", port: 443, protocol: "https", realm: "Restricted", authenticationMethod: NSURLAuthenticationMethodHTTPBasic) | |
URLCredentialStorage.shared.setDefaultCredential(credential, for: protectionSpace) | |
let config = URLSessionConfiguration.default |
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> | |
<html> | |
<head> | |
<title>Troop</title> | |
<%= stylesheet_link_tag 'application' %> | |
<%= javascript_include_tag 'application' %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> |
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
sudo add-apt-repository ppa:pitti/postgresql | |
sudo apt-get update | |
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2 | |
sudo su -l postgres | |
psql -d template1 -p 5433 | |
CREATE EXTENSION IF NOT EXISTS hstore; | |
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; | |
service postgresql stop | |
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf" |
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> | |
<!--[if lt IE 7]> <html class="ie6"> <![endif]--> | |
<!--[if IE 7]> <html class="ie7"> <![endif]--> | |
<!--[if IE 8]> <html class="ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html> <!--<![endif]--> | |
<head> | |
<meta name="viewport" content="width=device-width"> | |
<style> | |
/* | |
* simple reset |
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
<body> | |
<a href="#linkToTsnCs" class="showTerms">terms & conditions</a> | |
<body> |
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 mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
var assert = require('assert') | |
console.log('\n==========='); | |
console.log(' mongoose version: %s', mongoose.version); | |
console.log('========\n\n'); | |
var dbname = 'testing_gg-1351c8470075b095'; |
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
# A Sidekiq background job worker tha knows how to render Rails views | |
# Don't worry, I *think* I know what I'm doing ;) | |
class RenderWorker < AbstractController::Base | |
include AbstractController::Rendering | |
include AbstractController::Logger # dependency from actionview calling logging | |
include Rails.application.routes.url_helpers | |
include Sidekiq::Worker | |
append_view_path "#{Rails.root}/app/views" # from AbstractController::ViewPaths |
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
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz | |
tar -xvzf ruby-1.9.3-p125.tar.gz | |
cd ruby-1.9.3-p125/ | |
./configure --prefix=/usr/local | |
make | |
make install |
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
#!/bin/sh | |
#install me via: | |
#curl https://raw.github.com/gist/1031770/8d8400cbca40faa18bccc29d2f4d4b66371f5d7f/install.sh | sh | |
curl https://raw.github.com/gist/1008945/7532898172cd9f03b4c0d0db145bc2440dcbb2f6/load.patch > /tmp/load.patch | |
rvm get head # always good to make sure you're up to date with RVM | |
rvm reload | |
rvm cleanup all | |
rvm install ruby-1.9.2-p180 --patch /tmp/load.patch -n patched |
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
<h1>Demo code for "Extreme JavaScript Performance" @ JSConf.eu</h1> | |
<script> | |
var benchmark = function(m,i){ | |
var d1 = new Date, d2, r; | |
while(i--) r = m(); | |
d2 = new Date; | |
console.log(d2.getTime()-d1.getTime()); | |
// if(r) console.log(r); | |
} |
NewerOlder