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
// this pattern subscribes adds item to an array when subscribe function | |
// is is assigned to a variable, and unsubscribes when this variable is eventually called | |
// taken from Redux tutorial | |
// https://egghead.io/lessons/react-redux-implementing-store-from-scratch | |
// also discussed here | |
// https://stackoverflow.com/questions/35304790/es6-redux-returning-a-function-to-remove-event-listener | |
let listeners = [] |
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 functools | |
def my_decorator(func): | |
@functools.wraps(func) | |
def function_that_runs_func(): | |
print('Before the decorated function!') | |
func() | |
print('After the decorated function!') | |
return function_that_runs_func |
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 functools | |
def my_decorator_with_arguments(arg): | |
def my_decorator(func): | |
@functools.wraps | |
def function_that_runs_func(*args, **kwargs): | |
print('Before the decorated func!') | |
if arg: | |
print('Not running the func!') | |
else: |
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
// based on https://www.youtube.com/watch?v=mth5WpEc4Qs | |
"use strict"; | |
var add1 = function add1(num) { | |
return num + 1; | |
}; | |
var doubleIt = function doubleIt(num) { | |
return num * 2; | |
}; |
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
Sub RemoveAttachments() | |
Dim objSelection As Outlook.Selection | |
Dim i, n As Long | |
Dim objMail As Outlook.MailItem | |
Dim objAttachment As Outlook.Attachment | |
'Get the selected emails | |
Set objSelection = Outlook.Application.ActiveExplorer.Selection | |
'Process each email one by one |
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
// https://github.com/campoy/go-web-workshop/blob/master/section01/README.md | |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"strings" | |
) |
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
// https://github.com/campoy/go-web-workshop/blob/master/section01/README.md | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
res, err := http.Get("https://golang.org/ssssdfasdfa") |
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
// https://github.com/campoy/go-web-workshop/blob/master/section02/README.md | |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func helloHandler(w http.ResponseWriter, r *http.Request) { |
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
// https://github.com/campoy/go-web-workshop/blob/master/section01/README.md | |
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) |
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
// https://github.com/campoy/go-web-workshop/blob/master/section01/README.md | |
package main | |
import ( | |
"io" | |
"log" | |
"net/http" | |
"os" | |
) |
OlderNewer