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
function abc() { | |
var deferred = $.Deferred(); | |
(function() { | |
var a = 1; | |
deferred.resolve(a); | |
})(); | |
return deferred.promise(); | |
} |
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 myInt int | |
const unTypedC = 20 | |
const typedC int = 30 | |
func main() { |
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 "log" | |
func alterValue(val interface{}) { | |
INCR := 10 | |
switch i := val.(type) { | |
case nil: | |
log.Println("Nil value") |
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 "log" | |
type EventLogger interface { | |
Log() int | |
} | |
type EventA struct { | |
Id int |
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" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"os" | |
"sync" | |
) |
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 ( | |
"log" | |
"time" | |
) | |
type Inner struct { | |
Count int | |
} |
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 main() { | |
f() | |
fmt.Println("Returned normally from f.") | |
} | |
func f() { |
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
require 'logger' | |
require 'stringio' | |
def capture_output | |
old_stderr, $stderr = $stderr, StringIO.new | |
old_stdout, $stdout = $stdout, StringIO.new | |
yield | |
[$stderr.string, $stdout.string] | |
ensure | |
$stderr = old_stderr |
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
require 'logger' | |
# require 'stringio' | |
# StringIO also do as IO, but IO#reopen fails. | |
# The problem is that a StringIO cannot exist in the O/S's file descriptor | |
# table. STDERR.reopen(...) at the low level does a dup() or dup2() to | |
# copy one file descriptor to another. | |
# | |
# I have two options: |
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 BaseApp interface { | |
Name() | |
} |
OlderNewer