Skip to content

Instantly share code, notes, and snippets.

View rivertam's full-sized avatar
🎑
who can keep track

Ben Berman rivertam

🎑
who can keep track
View GitHub Profile
@rivertam
rivertam / checkhealth.out
Created June 23, 2017 23:39
:CheckHealth
health#deoplete#check
========================================================================
## deoplete.nvim
- SUCCESS: has("nvim") was successful
- SUCCESS: has("python3") was successful
- INFO: If you're still having problems, try the following commands:
$ export NVIM_PYTHON_LOG_FILE=/tmp/log
$ export NVIM_PYTHON_LOG_LEVEL=DEBUG
$ nvim
@rivertam
rivertam / hola.log
Created June 24, 2017 02:45
Neovim profiling
FUNCTION airline#extensions#neomake#get_errors()
Called 340 times
Total time: 0.006676
Self time: 0.002922
count total (s) self (s)
340 0.005072 0.001318 let counts = neomake#statusline#LoclistCounts()
340 0.000847 let errors = get(counts, 'E', 0)
340 0.000525 return errors ? s:error_symbol.errors : ''
@rivertam
rivertam / reduce.rb
Created October 31, 2017 21:12
What is reduce?
arr = ["cup", "cake", "birthday", "Jesus"]
# this will print "cup\ncake\nbirthday\nJesus", as you can imagine
for word in arr
puts word
end
def add_em_up()
acc = 5
for word in arr
@rivertam
rivertam / klass.h
Created December 20, 2017 19:02
Nice constructor style
class Klass {
Klass(const Param & p1, const Param & p2)
:
m1(p1),
m2(p2)
{}
Param m1;
Param m2;
}
@rivertam
rivertam / Catbrand.js
Created March 14, 2018 13:51
Getting count of brands
categorySchema.find({})
.exec()
.then(categories => {
// When you return a promise from a .then callback, the promise that gets returned from the original .then
// resolves when the inner promise that you return resolves
return Promise.all(categories.map(cat=> {
return brandSchema.find({category: cat._id}).count()
}));
})
.then(counts => {
const benchmark = require('benchmark');
const suite = new benchmark.Suite();
suite.add('var loop', () => {
var hi, i, list;
list = [];
for (i = 0; i < 50; ++i) {
hi = { str: 'hi', i };
@rivertam
rivertam / alignment_debug.txt
Created July 29, 2019 10:05
Alignment debug output of the stack overflow question
print-type-size type: `Big`: 24 bytes, alignment: 8 bytes
print-type-size discriminant: 1 bytes
print-type-size variant `Sixteen`: 16 bytes
print-type-size field `.0`: 16 bytes
print-type-size variant `Float`: 15 bytes
print-type-size padding: 7 bytes
print-type-size field `.0`: 8 bytes, alignment: 8 bytes
print-type-size variant `Twelve`: 12 bytes
print-type-size field `.0`: 12 bytes
print-type-size variant `Eight`: 8 bytes