- If you can't test the code efficiently, refactor the code.
- Don't hardcode URLs in views, templates and tests. (Use
revert
instead?) - Use named views and reverse URL resolution, instead.
- Never refactor against failing UNIT tests.
- Don't forget the REFACTOR on 'Red, Green, Refactor'.
- Tests makes possible using the application state as a save-points for refactors. Once you get to them again, you'll know your refactoring is done.
- Every single FT doesn't need to test every single part of your application, but use caution when de-duplicating your FTs. (FTs exist to catch unpredictable interactions between different parts of your application, after all)
- Use loggers named after the module you're in. Follow the
logging.getLogger(__filename__)
pattern to get a logger that's unique to your module, but that inherits from a top-level configuration you control.
Discover gists
import Foundation | |
extension Data { | |
init?(hexString: String) { | |
let len = hexString.count / 2 | |
var data = Data(capacity: len) | |
for i in 0..<len { | |
let j = hexString.index(hexString.startIndex, offsetBy: i*2) | |
let k = hexString.index(j, offsetBy: 2) | |
let bytes = hexString[j..<k] |
pragma solidity ^0.4.17; | |
/** | |
* @title SafeMath | |
* @dev Math operations with safety checks that throw on error | |
*/ | |
library SafeMath { | |
function mul(uint256 a, uint256 b) internal pure returns (uint256) { | |
if (a == 0) { | |
return 0; |
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |
This is still a new situation. There is a lot we don't know. We don't know if there are more possible exploit paths. We only know about this one path. Please update your systems regardless.
This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.
// exporting from a bs58 private key to an Uint8Array | |
// == from phantom private key to solana cli id.json key file | |
// npm install bs58 @solana/web3.js | |
const web3 = require("@solana/web3.js"); | |
const bs58 = require('bs58'); | |
let secretKey = bs58.decode("[base58 private key here]"); | |
console.log(`[${web3.Keypair.fromSecretKey(secretKey).secretKey}]`); | |
// exporting back from Uint8Array to bs58 private key |
Example notebook can be found here.
Docker on Lima is one of the alternative solutions to Docker Desktop for Mac.
Many people have already described the steps to set up for that.
In addition to such a standard setup, this guide describes how to set up a Docker environment which can run multi-arch images.
For example, you will be able to run linux/amd64
images on your M1 Mac.