This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package consumeapi | |
import ( | |
"net/http" | |
) | |
const Endpoint string = "http://api.provider.com" | |
type ConsumeApi struct { | |
Endpoint string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
class ConsumeAPI(object): | |
ENDPOINT = 'http://api.provider.com' | |
def get(self): | |
return requests.get(self.ENDPOINT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
type Callback func() | |
func JustPrintIt(msg string) { | |
fmt.Println(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func Catch() { | |
if r := recover(); r != nil { | |
fmt.Println(fmt.Sprintf("Recovered from : %v", r)) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func JustPrintIt(msg string) { | |
defer func() { | |
fmt.Println("Should be triggered after function called") | |
}() | |
fmt.Println(msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import mock | |
from module.my_class_a import MyClassA | |
class TestMyClassA(unittest.TestCase): | |
def setUp(self): | |
self._fake_path = '/path/to/the/fake/yaml/file' | |
@mock.patch('module.my_class_a.yaml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import mock | |
from module.my_class_a import MyClassA | |
class TestMyClassA(unittest.TestCase): | |
def setUp(self): | |
self._fake_path = '/path/to/the/fake/yaml/file' | |
@mock.patch('module.my_class_a.yaml') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
class MyClassA(object): | |
def to_test(self, path): | |
with open(path, 'r') as stream: | |
output = yaml.load(stream) | |
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctrl-k ctrl-w : close all files | |
ctrl-w q : close current file | |
ctrl-k ctrl-alt-w : close other files | |
alt-\ : fokus to sidebar / tree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
(function($) { | |
$.fn.confirmit = function(msg, successFunc) { | |
if (window.confirm(msg)) { | |
successFunc(); | |
} | |
return this; | |
}; |
NewerOlder