"use strict";
function doAsyncThing() {
let p = new Promise((resolve, reject) => process.nextTick(resolve)).then(() => {
console.log('after resolve', new Error().stack);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Enter Chat and press enter | |
<div><input id=input placeholder=you-chat-here /></div> | |
Chat Output | |
<div id=box></div> | |
<script src=http://cdn.pubnub.com/pubnub.min.js></script> | |
<script>(function(){ | |
var pubnub = PUBNUB.init({publish_key:'demo',subscribe_key:'demo',ssl:true}); | |
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="robots" content="noindex"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Site Maintenance</title> | |
<style> | |
body { text-align: center; padding: 150px; } | |
h1 { font-size: 50px; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -re -i http://url.com/playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <map> | |
#include <vector> | |
/** | |
* Provides a basic interpolation mechanism in C++ using the STL. | |
* Maybe not the fastest or most elegant method, but it works (for | |
* linear interpolation!!), and is fast enough for a great deal of | |
* purposes. It's also super easy to use, so that's a bonus. | |
*/ | |
class LinearInterpolator { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import styled from 'styled-components'; | |
const Title = styled.h1` | |
font-size: 1.5em; | |
text-align: center; | |
color: palevioletred; | |
`; | |
const Wrapper = styled.section` |
Know your components. Look at existing components before you create a brand new one. It is really fun to create new components but please ask yourself or the designer if we already have a component that might do the job first! Maybe you can create a variant of an existing component or just use it out of the box? It is important to evaluate the complexity of creating a variant. Sometimes it is smarter to create a new component. Discuss with your teammates!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <libudev.h> | |
#define MAX_KBD_DEVICES 10 | |
const char** detect_kbd_devices() | |
{ | |
const char **devnodes = calloc(MAX_KBD_DEVICES, sizeof(char*)); | |
struct udev *udev; | |
struct udev_enumerate *enumerate; | |
struct udev_list_entry *devices, *dev_list_entry; | |
struct udev_device *dev; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mixin like functionality | |
const textInput = props => ` | |
color: ${props.error ? color.white : color.base}; | |
background-color: ${props.error ? color.alert : color.white}; | |
`; | |
export const Input = styled.input` | |
${textInput} | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* usage: hexdump <file-in> [file-out] */ | |
#include <stdio.h> | |
#define CHUNK 16 | |
FILE *hexdump_open(const char *path, const char *mode) { | |
FILE *fp; | |
if (!(fp = fopen(path, mode))) { | |
printf("error opening '%s'", path); |
OlderNewer