- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
import { Wrapper } from "@googlemaps/react-wrapper"; | |
const ParentComponentThatWillReceiveGoogleMap = () => { | |
return <Wrapper apiKey={"42-l337-lol-bbq"}> | |
<MyGoogleMapComponent/> | |
</Wrapper> | |
} |
;; Using javax.imageio and funcool/cats | |
;; it's leaking fds, take care! | |
(defn valid-jpg-image? [image-url] | |
(let [image-input (-> image-url io/input-stream ImageIO/createImageInputStream) | |
encoders (-> (ImageIO/getImageReadersByFormatName "jpg") iterator-seq) | |
image-result (map #(either/try-either (doto % (.setInput image-input) (.read 0))) encoders)] | |
(->> image-result either/rights not-empty boolean))) |
def connection | |
@conn ||= PG.connect({ | |
host: ARGV.first, | |
port: 26257, | |
dbname: 'cocksparrer', | |
user: 'root', | |
sslmode: 'require', | |
sslrootcert: 'util/certs/cock-master/ca.crt', | |
sslcert: 'util/certs/cock-master/client.root.crt', | |
sslkey: 'util/certs/cock-master/client.root.key', |
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |
import threading | |
def cegela(): | |
while True: | |
pass | |
map(lambda y: y.start(), map(lambda x: threading.Thread(target=cegela), range(0,4))) |
#!/usr/bin/perl | |
# Author: Todd Larason <[email protected]> | |
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $ | |
# use the resources for colors 0-15 - usually more-or-less a | |
# reproduction of the standard ANSI colors, but possibly more | |
# pleasing shades | |
# colors 16-231 are a 6x6x6 color cube | |
for ($red = 0; $red < 6; $red++) { |
private String serialize(Object object) { | |
try { | |
ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |
ObjectOutputStream output = new ObjectOutputStream(buffer); | |
output.writeObject(object); | |
output.flush(); | |
return Base64.encodeBase64String(buffer.toByteArray()); | |
} catch (Exception e) { |
mysql> use rails_girls_sp; | |
Database changed | |
mysql> select count(sex) count, sex from persons group by sex; | |
+--------+------+ | |
| number | sex | | |
+--------+------+ | |
| 1887 | M | | |
| 3 | F | | |
+--------+------+ | |
2 rows in set, 1 warning (0.00 sec) |
require 'resque/tasks' | |
require 'active_record' | |
env = ENV["RAILS_ENV"] || 'development' | |
database_config = YAML::load(File.open('config/database.yml')) | |
connection = ActiveRecord::Base.establish_connection(database_config[env]) | |
files = ['app/models/profile', 'app/workers/avatar'] | |
files.each { |file| require File.expand_path(file) } |