-
Java uses static, declared typing:
String hello = "Hello, World!"; List<String> phrases = new ArrayList<String>; phrases.add(hello); phrases.add(null); phrases.add(123); // Compile error! Not a string.
This file contains hidden or 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
| //index.js | |
| var express = require('express'), | |
| app = module.exports = express.createServer(), | |
| mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/nodeAuth'); | |
| //configure app | |
| app.configure(function() { | |
| app.set('views', __dirname + '/views'); |
This file contains hidden or 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
| export CUDA_HOME=/usr/local/cuda | |
| export NVIDIA_HOME=/usr/local/nvidia | |
| export PATH=${CUDA_HOME}/bin:${PATH} | |
| export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH} |
This file contains hidden or 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 apt-get update | |
| sudo apt-get install -y python-software-properties software-properties-common | |
| sudo add-apt-repository -y ppa:pi-rho/dev | |
| sudo apt-get update | |
| sudo apt-get install -y tmux=2.0-1~ppa1~t |
This file contains hidden or 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 open-for-business? (atom true)) | |
| (def haircut-count (agent 0)) | |
| (def waiting-room (ref [])) | |
| (def waiting-room-size 3) | |
| (defn open-shop [duration] | |
| (do (Thread/sleep duration) (swap! open-for-business? not))) | |
| (defn add-customers [] | |
| (future |
This file contains hidden or 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 'faraday' | |
| field_file_url = 'http://localhost/blah' | |
| file_to_upload = 'test.txt' | |
| connection = Faraday.new(field_file_url) do |builder| | |
| builder.request :multipart | |
| builder.request :url_encoded | |
| builder.adapter :net_http | |
| end |
This file contains hidden or 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
| .git | |
| .gitignore | |
| doc | |
| .yardoc | |
| coverage | |
| jsdoc | |
| tmp | |
| log | |
| README.md | |
| public/uploads/ |
This file contains hidden or 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 "open-uri" | |
| require "net/http" | |
| Error = Class.new(StandardError) | |
| DOWNLOAD_ERRORS = [ | |
| SocketError, | |
| OpenURI::HTTPError, | |
| RuntimeError, | |
| URI::InvalidURIError, |
This file contains hidden or 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
| # in controller | |
| # for local files | |
| send_file '/path/to/file', :type => 'image/jpeg', :disposition => 'attachment' | |
| # for remote files | |
| require 'open-uri' | |
| url = 'http://someserver.com/path/../filename.jpg' | |
| data = open(url).read | |
| send_data data, :disposition => 'attachment', :filename=>"photo.jpg" |
For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt