Skip to content

Instantly share code, notes, and snippets.

View sescobb27's full-sized avatar
🇨🇴
sisas parce

Simon Escobar Benitez sescobb27

🇨🇴
sisas parce
View GitHub Profile

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@sescobb27
sescobb27 / app.js
Last active August 29, 2015 14:16 — forked from kirschbaum/app.js
var myApp = angular.module('myApp', []);
myApp.directive('googleplace', function() {
return {
require: 'ngModel',
scope: {
ngModel: '=',
details: '=?'
},
link: function(scope, element, attrs, model) {
@sescobb27
sescobb27 / future.go
Last active August 29, 2015 14:17 — forked from davecheney/future.go
package future
// A Future represents the result of some asynchronous computation.
// Future returns the result of the work as an error, or nil if the work
// was performed successfully.
// Implementers must observe these invariants
// 1. There may be multiple concurrent callers, or Future may be called many
// times in sequence, it must always return the same value.
// 2. Future blocks until the work has been performed.
type Future func() error
package main
import (
"time"
)
type LazyInt chan func() int
// Can't use pointer receiver: invalid operation: l <- (func literal) (send to non-chan type *LazyInt)
func (l LazyInt) Future(i int) {
@sescobb27
sescobb27 / readers-writers.go
Created April 4, 2015 07:44
Mutex readers-writers
package main
import (
"log"
"os"
"rand"
"sync"
"time"
)
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//
source 'https://rubygems.org'
gem 'rails', '4.2.0'
ruby '2.2.2'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'dotenv-rails', require: 'dotenv/rails-now'
gem 'byebug', '~> 4.0.0'
@sescobb27
sescobb27 / deploy.yml
Last active August 29, 2015 14:20 — forked from mokevnin/Dockerfile
- hosts: localhost
gather_facts: no
tasks:
- local_action:
module: slack
domain: hexlet.slack.com
token: {{ slack_token }}
msg: "deploy started: {{ rails_env }}:{{ hexlet_image_tag }}"
channel: "#operation"
username: "{{ ansible_ssh_user }}"
package main
import (
"log"
"net/http"
"github.com/bradfitz/http2"
)
func main() {