Skip to content

Instantly share code, notes, and snippets.

@nchevobbe
nchevobbe / screenshot.js
Last active September 4, 2018 13:22
Log a data URL containing a screenshot of the window
let canvas = window.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas");
let context = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
context.drawWindow(window, 0, 0, canvas.width, canvas.height, "white");
console.log(`
📸 📸 📸 📸
${canvas.toDataURL()}

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@dshaw
dshaw / levelup.md
Last active November 17, 2022 14:52
Leveling-up on Node

Core Principals

  • Read lots of code.
  • Write lots of code.
  • Don’t be afraid to throw it away.
  • Don’t be afraid to share it.
  • Find your happy place writing tests.
    • You’ll probably spend more time writing tests and debugging than writing code. Embrace this. Make it a key part of your workflow.
    • Tests are one of the first things I read in a module. That and the example(s). Probably before API docs.
  • Don’t know where to start. Write some tests for a module you like. This benefits everyone.
@brianleroux
brianleroux / gruntfile.js
Created August 27, 2013 17:35
calling `npm test` from `grunt test`
var shell = require('shelljs')
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
})
grunt.registerTask('default', 'My "default" task description.', function() {
grunt.log.writeln('Currently running the "default" task.');
@domenic
domenic / 1-Domenic.js
Last active September 30, 2021 15:43
How DI container config should work (in JS)
"use strict";
// Domenic needs a Tweeter
function Domenic(tweeter) {
this.tweeter = tweeter;
}
Domenic.inject = ["tweeter"];
Domenic.prototype.doSomethingCool = function () {
return this.tweeter.tweet("Did something cool!");
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013
<!DOCTYPE>
<html>
<head>
<title>Dissecting Gmail's Email Attachments - Dropping Files</title>
<style>
.msg {
display: none
}
.dragging .msg {
function whichTransitionEvent(){
var t;
var el = document.createElement('fakeelement');
var transitions = {
'transition':'transitionend',
'MSTransition':'msTransitionEnd',
'MozTransition':'transitionend',
'WebkitTransition':'webkitTransitionEnd'
}
@max-mapper
max-mapper / readme.md
Last active June 3, 2020 00:31
automatically scan for and join open internet enabled wifi networks on linux using node.js (tested on raspberry pi raspbian)
@max-mapper
max-mapper / readme.md
Created December 6, 2012 20:50
hybrid app article topics
  • touch events to make web apps feel fast
  • default mobile css overrides (-webkit-touch-callout: none; etc)
  • using zepto to make mobile web apps
  • client side templating and routing for quick loading apps
  • supporting retina devices with sprites
  • css3 flexible box model and column layouts for responsive web apps
  • using phonegap to deploy web apps as native
  • web first development workflow (chrome dev tools, safari debugging)
  • how to submit a web app to the app store + google play
  • cross platform mobile code via feature detection