2017-01-18 To run tests in Rust in tests
directory which use src
files, you need to reference the package name
src/lib.rs
pub fn hello() {
println!("Hello, world!");
}
tests/my_test.rs
extern crate hello_world;
#[test]
fn test_prints_hello() { assert_eq!("Hello, world!", hello_world::hello()); }
where hello_world
is the project/package name
[pub] mod my {
// Items in modules default to private visibility.
fn private_function() {
println!("called `my::private_function()`");
}
// Use the `pub` modifier to override default visibility.
pub fn function() {
println!("called `my::function()`");
}
}
The PNG singature is composed of the following ASCII values:
- 137 A byte with its most significant bit set (8-bit character)
- 80 P
- 78 N
- 71 G
- 13 Carriage-return (CR) character, a.k.a. CTRL-M or ^M
- 10 Line-feed (LF) character, a.k.a. CTRL-J or ^J
- 26 CTRL-Z or ^Z
- 10 Line-feed (LF) character, a.k.a. CTRL-J or ^J
It is then possible to pack HTML/CSS/JS into the content and serve it as ana image. Arbitrary PNG content
Similarly, substract 32 from any ASCII lowercase character to obtain the uppercase.
a = chr(ord('A') + 32)
A = chr(ord('a') - 32)
2016-11-23 Configure httpie timeout with a default config
~/.httpie/config.json
"default_options": ["--style=fruity", "--body"]
It is now possible to specify environment variables in AWS Lambda
@Captor
private ArgumentCaptor<Pair<String, Account>> accountCaptor;
@Test
public void argumentCaptor() {
when(service.disableAccount(account.capture()).thenReturn(...);
Pair<String, Account> accountArgument = accountCaptor.get();
...
}
echo "payload" | curl -d @-
2016-05-12 Easy git directory publish with git-directory-deploy
2016-05-10 Discovered Elm Lang
async function makeAction() : Promise<Object> {
const data = await Async.get(...);
return { type: 'ACTION_TYPE', data };
}
CMD+ALT+.
CTRL+SHIFT+M
npm list -g --depth=0
class SpinningSquare extends React.Component {
state = {
rotation: new Animated.Value(0)
}
/* Duration drives the speed of each rotation */
componentDidMount() {
const timingConfig = { toValue: 1, duration: 1000, easing: Easing.linear }
this.animation = Animated.timing(this.state.rotation, timingConfig)
this._animate()
}
_animate = () => {
this.state.rotation.setValue(0); // Needs to be reset after a full rotation
this.animation.start(this._animate); // self as callback onFinished
}
render() {
const rotate = this.state.rotation.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'] })
return (
<Animated.View style={{
width: 40,
height: 40,
backgroundColor: 'red',
transform: [{ rotate }]
}} />
)
}
}
Learned some vim commands through vimtutor
Learned how to use iOS Facebook login with the Facebook SDK
How to use Firebase as a messagining queue with firebase-queue
Loading the BIOS after the power button is pressed on a pc
How to use FP with lodash
Learned how exhausting finishing a dissertation is :)
How objects and inheratiance works in Go from build-web-applications-with-golang
Memcached performance drastically increases with thread pinning and IRQ pinning.
Investigated how IRQ affinity works. Learned you can obtian the number of interrupts executed on a given CPU core through cat /proc/interrupt
as well as how setting IRQ Affinity to a given CPU/CPUs works. We can provide the list of values in /proc/irq/<irq_id>/smp_affinity_list
.
Learned about functors, Maybe, Either and IO from mostly-adequate-guide
Functional programming with JavaScript through the awesome mostly-adequate-guide.