Skip to content

Instantly share code, notes, and snippets.

// Intercepting HTTP calls with AngularJS.
angular.module('MyApp', [])
.config(function ($provide, $httpProvider) {
// Intercept http calls.
$provide.factory('MyHttpInterceptor', function ($q) {
return {
// On request success
request: function (config) {
// console.log(config); // Contains the data about the request before it is sent.
@chris-ramon
chris-ramon / osxnotes.txt
Created February 1, 2015 05:05
osx notes
# 'You have new mail'
mail
d *
q
@chris-ramon
chris-ramon / ssh.bash
Created January 31, 2015 19:21
ssh notes
# generate new pair of keys
ssh-keygen -f /Users/chris/Desktop/jwt-demo/id_rsa
@chris-ramon
chris-ramon / curl.sh
Last active August 12, 2022 23:36
curl notes
· curl
curl -G "https://api.github.com/search/repositories?page=1&per_page=6" --data-urlencode "sort=stars" --data-urlencode "order=desc" --data-urlencode "q=language:html" | jq ".items[0,1,2,3,4,5] | {name, description, html_url}"
# set headers
curl localhost:8080 --header "jwt: mycooltoken"
# display headers
curl localhost:8080 -v
# show output in new line
@chris-ramon
chris-ramon / go.go
Last active August 29, 2015 14:12
go convention notes
//naming errors
//errErrorName
//eg
//https://github.com/golang/go/blob/439b32936367c3efd0dadab48dd51202e1a510f1/src/os/error.go#L13
errDB := someFunc()
package event
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/suite"
@chris-ramon
chris-ramon / utils.go
Last active August 29, 2015 14:11 — forked from Luit/utils.go
package utils
func Slugify(title string) string {
var slug []byte
for _, x := range title {
switch {
case ('a' <= x && x <= 'z') || ('0' <= x && x <= '9'):
slug = append(slug, byte(x))
case 'A' <= x && x <= 'Z':
package main
import (
"encoding/xml"
"net/http"
"net/url"
"fmt"
"strings"
"io/ioutil"
"encoding/json"
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
)
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
)