This for loop:
for (let i = 0, getI = () => i; i < 3; i++)
console.log(getI());
unrolls to:
#!/bin/bash | |
PROJECT_ID=$(gcloud config get-value project) | |
SERVICES=$(gcloud beta run services list --format='value(SERVICE,REGION)') | |
MAX_RETRIES=3 | |
RETRY_DELAY=5 | |
function delete_revision_with_retry() { | |
local REVISION=$1 |
This for loop:
for (let i = 0, getI = () => i; i < 3; i++)
console.log(getI());
unrolls to:
import SwiftUI | |
extension CGRect { | |
fileprivate func point(anchor: UnitPoint) -> CGPoint { | |
var point = self.origin | |
point.x += self.size.width * anchor.x | |
#if os(macOS) | |
point.y += self.size.height * (1 - anchor.y) | |
#else | |
point.y += self.size.height * anchor.y |
( function() | |
{ | |
const darkMode = document.getElementById( 'dark-mode-toggle' ); | |
if( darkMode ) | |
{ | |
const isDarkSchemePreferred = () => window.matchMedia && window.matchMedia( '(prefers-color-scheme: dark)' ).matches; | |
darkMode.addEventListener( 'click', function( e ) | |
{ |
import SwiftUI | |
let dateFormatter = DateFormatter() | |
struct NoteItem: Codable, Hashable, Identifiable { | |
let id: Int | |
let text: String | |
var date = Date() | |
var dateText: String { | |
dateFormatter.dateFormat = "MMM d yyyy, h:mm a" |
None of the string methods modify this
– they always return fresh strings.
charAt(pos: number): string
ES1
Returns the character at index pos
, as a string (JavaScript does not have a datatype for characters). str[i]
is equivalent to str.charAt(i)
and more concise (caveat: may not work on old engines).
From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:
There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.
That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.
# maximum capability of system | |
user@ubuntu:~$ cat /proc/sys/fs/file-max | |
708444 | |
# available limit | |
user@ubuntu:~$ ulimit -n | |
1024 | |
# To increase the available limit to say 200000 | |
user@ubuntu:~$ sudo vim /etc/sysctl.conf |
In the process of evaluating the suitability of SFSafariViewController
(SFSVC) for use within the Twitter iOS client, I encountered a number of bugs
with differing severities, all of which I filed as Radars in Apple's bug
reporting tool. Here is my attempt to holistically document their impact on our
ability to adopt SFSafariViewController
as a replacement for our existing
WebViews.
The fundamental blocker is Radar
Prerequisites : the letsencrypt CLI tool
This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.
You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge
.
Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.
I redirect all HTTP requests on HTTPS, so my nginx config looks like :
server {