Given a database with two tables.
select * from users;
+----+------+
| id | name |
+----+------+
Given a database with two tables.
select * from users;
+----+------+
| id | name |
+----+------+
declare global { | |
namespace jest { | |
interface Matchers<R> { | |
toBeFasterThan(target: number): Promise<CustomMatcherResult>; | |
} | |
} | |
} |
For the last two years I've been using Ubuntu Linux for software development. | |
Last week I got a MacBook Pro and have been changing over. I run a heavily | |
customized vim setup, so the change was particularly difficult with regards to | |
my keyboard layout. | |
These step show what I did to make my Mac work like my Linux machines which all | |
have caps-lock remapped to control. I used OSX's built in keyboard setup tool | |
to remap my caps-lock key to be a command key, since command, for the most | |
part, takes the place of control as the primary shortcut key modifier. |
# I want a list of 6 non-administrators who are not the | |
# current user only if someone is logged in. Otherwise, | |
# don't check current_user's id. | |
# instead of this: | |
if user_signed_in? | |
@other_users = User.non_admin.limit(6).where("name IS NOT NULL") | |
else | |
@other_users = User.non_admin.limit(6).where(['id != ?', @user.id]).where("name IS NOT NULL") |
// Adafruit IO Digital Input Example | |
// Tutorial Link: https://learn.adafruit.com/adafruit-io-basics-digital-input | |
// | |
// Adafruit invests time and resources providing this open source code. | |
// Please support Adafruit and open source hardware by purchasing | |
// products from Adafruit! | |
// | |
// Written by Todd Treece for Adafruit Industries | |
// Copyright (c) 2016 Adafruit Industries | |
// Licensed under the MIT license. |
#!/usr/bin/env ruby | |
# ws=open('/usr/share/dict/words').readlines.map(&:strip).select{|w|/^[a-z]{7}$/=~w};100.times{p ws.sample(6).join(' ')} | |
ws=open('/usr/share/dict/words').readlines.select {|w| | |
/^[a-z]{5,7}\b/ =~ w | |
}.map(&:strip) | |
def n | |
(rand() * 89 + 10).floor.to_s | |
end |
#!/usr/bin/env python | |
""" | |
Download all data from a list of Adafruit IO feeds. Change constants in this | |
file in the CONFIGURATION section before you run the script. | |
Usage: | |
$ START="2019-05-01T00:00Z" END="2019-06-01T00:00Z" \ | |
python download_paged_data.py | |
""" |
To run these examples, you'll need the Ruby MQTT library:
$ gem install mqtt
And you'll need to set the various environment variables the scripts expect to find. To do that, create a file named profile
in the same directory you plan to run the scripts from. Fill in the AIO_USER
and AIO_KEY
values with your own.
$ cat < profile
// npm install; npm start | |
const http = require('http'), | |
faye = require('faye'); | |
const server = http.createServer(), | |
bayeux = new faye.NodeAdapter({mount: '/signal', timeout: 45}); | |
bayeux.attach(server); | |
server.listen(8080); |
/*************************************************** | |
Adafruit MQTT Library ESP8266 Example | |
Must use ESP8266 Arduino from: | |
https://github.com/esp8266/Arduino | |
Works great with Adafruit's Huzzah ESP board & Feather | |
----> https://www.adafruit.com/product/2471 | |
----> https://www.adafruit.com/products/2821 |