Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| #!/bin/sh | |
| # | |
| # Example showing use of getopt detection and use of GNU enhanced getopt | |
| # to handle arguments containing whitespace. | |
| # | |
| # Written in 2004 by Hoylen Sue <hoylen@hoylen.com> | |
| # | |
| # To the extent possible under law, the author(s) have dedicated all copyright and | |
| # related and neighboring rights to this software to the public domain worldwide. | |
| # This software is distributed without any warranty. |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| -- AppleScript -- | |
| -- This example is meant as a simple starting point to show how to get the information in the simplest available way. | |
| -- Keep in mind that when asking for a `return` after another, only the first one will be output. | |
| -- This method is as good as its JXA counterpart. | |
| -- Webkit variants include "Safari", "Webkit", "Orion". | |
| -- Specific editions are valid, including "Safari Technology Preview". | |
| -- "Safari" Example: | |
| tell application "Safari" to return name of front document |
| ———————————————————————————————————————————————————————————————————————————————————————————————————— | |
| BBEdit / BBEdit-Lite / TextWrangler Regular Expression Guide Modified: 2018/08/10 01:19 | |
| ———————————————————————————————————————————————————————————————————————————————————————————————————— | |
| NOTES: | |
| The PCRE engine (Perl Compatible Regular Expressions) is what BBEdit and TextWrangler use. | |
| Items I'm unsure of are marked '# PCRE?'. The list while fairly comprehensive is not complete. |
| 2.0.0-p0 |
| // Google SERP URL rewrite | |
| // | |
| // User script will rewrite search engine results page for Google and place real | |
| // links to results rather than links that proxy back via google. | |
| // | |
| // So you go straight to the page when you click and you can copy/paste the link | |
| // | |
| // Install: | |
| // 1. Download to desktop/wherever | |
| // 2. Open Chrome extensions page (Window -> Extensions) or URL chrome://extensions |
| def s3_form_tag(options = {}) | |
| bucket = options[:bucket] | |
| access_key_id = options[:access_key_id] | |
| secret_access_key = options[:secret_access_key] | |
| key = options[:key] || '' | |
| content_type = options[:content_type] || '' # Defaults to binary/octet-stream if blank | |
| redirect = options[:redirect] || '/' | |
| acl = options[:acl] || 'public-read' | |
| expiration_date = options[:expiration_date].strftime('%Y-%m-%dT%H:%M:%S.000Z') if options[:expiration_date] | |
| max_filesize = options[:max_filesize] || 671088640 # 5 gb |
| if params[:query].present? | |
| # not doing :* prefix matching right now. | |
| # Preprocess the string into what TSvector wants. spaces -> ? | |
| # Then only letters, numbers, underscores and qmarks are left. | |
| query = params[:query].gsub(/\s+/, '?').gsub(/[^\w\?]/, '') | |
| @results = @results.select { [ts_headline('english', :text, to_tsquery('english', query), 'MaxFragments=2').as(headline), id, title, happened_at]} | |
| @results = @results.filter("ts_text @@ to_tsquery('english', ?::text)", query) | |
| end | |
| require 'openssl' | |
| require 'socket' | |
| KEY = OpenSSL::PKey::RSA.new <<-_end_of_pem_ | |
| -----BEGIN RSA PRIVATE KEY----- | |
| MIICXgIBAAKBgQDLwsSw1ECnPtT+PkOgHhcGA71nwC2/nL85VBGnRqDxOqjVh7Cx | |
| aKPERYHsk4BPCkE3brtThPWc9kjHEQQ7uf9Y1rbCz0layNqHyywQEVLFmp1cpIt/ | |
| Q3geLv8ZD9pihowKJDyMDiN6ArYUmZczvW4976MU3+l54E6lF/JfFEU5hwIDAQAB | |
| AoGBAKSl/MQarye1yOysqX6P8fDFQt68VvtXkNmlSiKOGuzyho0M+UVSFcs6k1L0 | |
| maDE25AMZUiGzuWHyaU55d7RXDgeskDMakD1v6ZejYtxJkSXbETOTLDwUWTn618T |
Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).
This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.
If you want to use or share this material, please see the license file, below.