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
// You don't want to serve HTTPS supporting for SSL3.0 any longer, see:
// http://googleonlinesecurity.blogspot.de/2014/10/this-poodle-bites-exploiting-ssl-30.html
import (
"crypto/tls"
"net/http"
)
// This code supports SSL3.0, TLS1.0, TLS1.1 and TLS1.2
// Chances are you currently do this but want to stop due to the POODLE
err := http.ListenAndServeTLS(addr, "crtfile", "keyfile", handler)
package main
import (
"net"
"os"
)
func main() {
strEcho := "Halo"
servAddr := "localhost:6666"
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr)

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) {
// 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
//
@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() {