Skip to content

Instantly share code, notes, and snippets.

@repi
repi / crate-health.md
Last active July 30, 2024 17:22
Guidelines on evaluating health & quality of third-party crates at Embark

What to evaluate and consider before adding usage of new third-party crates.

These are not exact requirements but questions to investigate and discuss to help reason around the health, safety, maintainability, and more around crates.

This can also be read as an opinionated guide for crate authors of what our (Embark's) guidelines and recommendations are, though should not be taken too literally.

Legend: 🔒 Must have, ⭐️ Should have, 👍 Nice to have, ℹ️ Info

@ammario
ammario / ipint.go
Last active February 7, 2025 05:24
Golang IP <-> int conversion
func ip2int(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func int2ip(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
@plouc
plouc / App.jsx
Last active July 2, 2017 03:54
Mozaïk realtime communication example
// mozaik-demo/src/App.jsx
import React from 'react';
import Mozaik from 'mozaik/browser';
import Realtime from './Realtime.jsx';
Mozaik.Registry.add('realtime.example', Realtime);
const MozaikComponent = Mozaik.Component.Mozaik;
React.render(<MozaikComponent/>, document.getElementById('mozaik'));
@henrysher
henrysher / reinvent.md
Last active October 9, 2024 15:54
link for reinvent slides
@artjomb
artjomb / 1_phantomErrors.js
Last active April 5, 2022 22:10
Error event handlers for PhantomJS and CasperJS: PhantomJS and CasperJS don't show errors on the page by default. This can give clues as to what did go wrong.
var page = require('webpage').create(),
url = 'http://example.com/';
// Put the event handlers somewhere in the code before the action of
// interest (opening the page in question or clicking something)
// http://phantomjs.org/api/webpage/handler/on-console-message.html
page.onConsoleMessage = function(msg, lineNum, sourceId) {
console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")');
};
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active June 20, 2025 00:46
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@kachayev
kachayev / concurrency-in-go.md
Last active May 4, 2025 05:48
Channels Are Not Enough or Why Pipelining Is Not That Easy
@drio
drio / producer-consumer-go.md
Last active January 6, 2024 15:00
producer consumer in go explained

Producer consumer pattern

Question: Can you write code implementing the consumer and producer pattern?

This is a classic concurrency problem where we have threads generating data to be consumed (producers) by other threads (consumers).

The implementation with POSIX threads can be a pain in the ass but it is quite straight forward in golang thanks to its concurrency constructs.

@thekid
thekid / php.md
Last active August 29, 2015 13:57
PHP: Steps to excellence

A while ago, maybe two years or so at the time of writing, I began thinking PHP was dead. There were releases, and bugfixes, of course, but no noticeable innovation strategy. It's over the zenith, I believed, and that we'd see a slow but steady decline in projects. Time for rethinking technology at home and at work?

Today, it seems my thoughts were too early: The PHP group has since released PHP 5.4, 5.5 and the first alpha of 5.6. Each of them has brought a list of improvements not only on the detail level, but actually meaningful to adapting to nowaday's languages: Short array syntax, traits, method and array call chaining, full closure support, generators (yield), to name just a few. Also, they finally managed to rid themselves of the magic quotes crap. At the same time, each release has brought performance and memory usage improvements. And all that without compromising on stability: The number of critical bugs is perceivedly on an all-time low.

Also, the rise of Composer and its becoming a pseudo-stand

anonymous
anonymous / gist:6905817
Created October 9, 2013 18:24
The case for go (with citations!)
Team behind Go:
- Ken Thompson
- Co-Creator of Unix
- Co-Creator of UTF-8
- Creator of 'B', the direct predecessor to the 'C' programming language
- Rob Pike
- Co-Creator of Unix
- Co-Creator of UTF-8
- Co-Authored Practice of Programming and The Unix Programming Environment with Brian Kernighan