Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.
- ⌘ : Command key
- ⌃ : Control key
- ⌫ : Delete key
- ← : Left arrow key
- → : Right arrow key
- ↑ : Up arrow key
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.
# Initialize the scroll | |
page = es.search( | |
index = 'yourIndex', | |
doc_type = 'yourType', | |
scroll = '2m', | |
search_type = 'scan', | |
size = 1000, | |
body = { | |
# Your query's body | |
}) |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
from datetime import datetime | |
from os import path | |
import smtplib | |
import sys |
#!/usr/bin/env python | |
# Reflects the requests from HTTP GET methods | |
# Written by Nathan Hamiel (2010), modified by Michael Goodness (2015) | |
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
from argparse import ArgumentParser | |
from urlparse import urlparse | |
import daemon | |
import socket |
#!/usr/bin/env python | |
#-*- coding=utf-8 -*- | |
import requests | |
import re | |
import os | |
import copy | |
host = 'v2ex.com' | |
headers = { |
defprotocol
: defines an interfacedeftype
: create a bare-bones object which implements a protocoldefrecord
: creates an immutable persistent map which implements a protocolTypically you'll use defrecord
(or even a basic map
);
unless you need some specific Java inter-op,
where by you'll want to use deftype
instead.
Note:
defprotocol
allows you to add new abstractions in a clean way Rather than (like OOP) having polymorphism on the class itself,
;; After connecting an nrepl client repl to an nrepl server, some | |
;; output will still appear on stdout from the server. | |
;; Try these snippets - they will both produce output on the nrepl server | |
;; Java libraries commonly do both these things. | |
(.println System/out "Hello stdout.") | |
(.start (Thread. #(println "Hello from a new thread."))) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
(ns demo.record | |
(:require [criterium.core :refer [bench with-progress-reporting]])) | |
(def a-z-ks (map (comp keyword str) (seq "abcdefghijklmnopqrstuwvxyz"))) | |
(def dummy-map (zipmap a-z-ks (range))) | |
(defmacro alphabet-macro [] | |
`(do | |
(defrecord ~'Alphabet [~@(map (comp symbol str) a-z-ks)]) | |
(def ~'dummy-record (~'Alphabet. ~@(range 26))))) |
(def dataset (interleave (range 10000000) (range))) | |
(defn workflow [ds] | |
(->> ds | |
(dedupe) | |
(map #(* % %)) | |
(filter #(= 0 (rem % 111))) | |
(take 10))) |