Skip to content

Instantly share code, notes, and snippets.

View theohogberg's full-sized avatar
🛠️

Theo theohogberg

🛠️
View GitHub Profile
@toddmotto
toddmotto / *.md
Last active April 25, 2023 09:06
Component versus Directive in AngularJS

Component versus Directive in AngularJS

.component()

Components are not "helper" methods, they are the best change in Angular 1.x since I've been using it.

What is the role of .component()?

  • Declares new HTML via a template or templateUrl
  • Should be used to create Components as part of a Component architecture

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).

@proudlygeek
proudlygeek / commands-channel.go
Last active March 31, 2024 03:31
Golang Commands in Goroutines
package main
import (
"fmt"
"log"
"os/exec"
"runtime"
)
type Worker struct {

WHEN TO USE DIRECTIVES, CONTROLLERS, OR SERVICES IN ANGULAR JS

SERVICES

Whenever we want to share data across domains. Additionally, thanks to Angular’s dependency injection system, this is both very easy to do and very clean.

module.service( 'Book', [ '$rootScope', function( $rootScope ) {
 var service = {
@dongyuwei
dongyuwei / phantomjs-netsniff.js
Created September 10, 2012 09:33
phantomjs auto netsniff, create HAR file.
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function () {
function pad(n) { return n < 10 ? '0' + n : n; }
function ms(n) { return n < 10 ? '00'+ n : n < 100 ? '0' + n : n }
return this.getFullYear() + '-' +
pad(this.getMonth() + 1) + '-' +
pad(this.getDate()) + 'T' +
pad(this.getHours()) + ':' +
pad(this.getMinutes()) + ':' +
pad(this.getSeconds()) + '.' +