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
LEVEL=1.3&& RES=92 && gs -sDEVICE=pdfwrite -dCompatibilityLevel=$LEVEL -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -dColorImageDownsampleType=/Bicubic \ -dColorImageResolution=$RES \ -dGrayImageDownsampleType=/Bicubic \ -dGrayImageResolution=$RES \ -dMonoImageDownsampleType=/Subsample \ -dMonoImageResolution=$RES \ -sOutputFile=output.pdf input.pdf |
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
Some Tips to do a better code or points to have in mind when do a cross code-review: | |
- Classes and methods small -> Classes should represent simple entities. Methods should have one job. This is crucial for testing, refactoring, understanding, and maintaining. | |
- Make class fields private, and provide getters when necessary -> This is necessary to encapsulate the logic in a class, so callers are not dependent on the class implementation. | |
- Immutable classes -> Usage of setters are not a good practice. Using this on the classes, will let the data mutable, and the results can be catastrophic. Also, use final on variables (this will make them immutable). | |
- Avoid large blocks of code -> Use whitespace to separate tiny, logical chunks of code. (Do not be afraid of whitespace. It is your friend.) Use inline documentation to describe unclear bits of code, but better yet, restructure your code and rename methods/variables until the code is clear. |
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
(defmulti std-to-militar (fn [hour time-info] (keyword time-info))) | |
(defmethod std-to-militar :AM [hour _] | |
(format "%02d" (if (= hour 12) 0 hour))) | |
(defmethod std-to-militar :PM [hour _] | |
(if (= hour 12) hour (+ hour 12))) | |
(defn convert-time [hour] | |
(let [[hour minute seconds time-info] (rest (re-find #"(\d+):(\d+):(\d+)(\w+)" hour))] |
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
(ns merrychristmas.core | |
(:require [reagent.core :as reagent :refer [atom]])) | |
(defn greetings [] | |
(letfn [(crazy-letters [size] (clojure.string/join " " (take size (repeatedly #(rand-nth (range -20 10))))))] | |
[:svg#merry {:width "1000px" | |
:height "900px"} | |
[:text {:x "600px" | |
:y "260px" | |
:font-family "sans-serif" |
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
(ns mastermind.core | |
(:gen-class)) | |
(defn generate-numbers [] | |
(let [game [1 2 3 4 5 6]] | |
(->> game shuffle (take 4) vec))) | |
(defn guess [user answer] | |
(map #(= %1 %2) user answer)) |
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
# -*- coding: utf-8 -*- | |
import requests | |
from lxml.html import fromstring | |
import os, sys | |
piratebay = "https://thepiratebay.se/search/{0}/0/99/0" | |
kickass = "https://kickass.to/usearch/{0}/" | |
magnet=lambda link, local: os.system('aria2c --conf-path=$HOME/.aria2c.torrent --max-download-limit=1100K --max-upload-limit=15K --listen-port=63654 "' + link + '" -d '+ local +' --seed-time=1') |
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
# -*- coding: utf-8 -*- | |
import requests | |
from lxml.html import fromstring | |
import os | |
kickass = "https://kickass.to/usearch/{0}/" | |
magnet=lambda link, local: os.system('aria2c --conf-path=$HOME/.aria2c.torrent --max-download-limit=1100K --max-upload-limit=15K --listen-port=63654 "' + link + '" -d '+ local +' --seed-time=1') | |
localFolder="~/Vídeos/Seriados/Gotham" |
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
;; Bingo Real recriado em Lisp | |
;; - Roda direto no Emacs - | |
;; | |
;; Como rodar: | |
;; - Abrir o arquivo no Emacs | |
;; - Alt-x | |
;; - Digitar eval-current-buffer | |
;; - Os assuntos serao gerados na area de mensagens apertando Control-F2 | |
(require 'cl) |
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
(defonce color-map (range 255)) | |
(defn rand-color [max] | |
(nth color-map (rand-int max))) | |
(defn rainbownize [& text] | |
(->> (clojure.string/join #" " text) | |
seq | |
(map #(str "\033[38;5;" (rand-color 254) "m" % "\033[0m")) | |
(apply str))) |
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
(ns test-macro.utils) | |
(defn test-me [] | |
(str "Test me")) | |
(defn test-you [] | |
(str "Test you")) | |
(defn run-me [fn] | |
(eval (read-string (str "(test-macro.utils/test-" fn ")")))) |
NewerOlder