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 | |
// Answer: 25164150 | |
// Find the difference between the sum of the squares | |
// of the first one hundred natural numbers and the square of the sum. | |
// Function that returns a channel | |
// real 0m0.284s | |
// user 0m0.151s | |
// sys 0m0.066s |
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 | |
// Answer: 25164150 | |
// Find the difference between the sum of the squares | |
// of the first one hundred natural numbers and the square of the sum. | |
import ( | |
"fmt" | |
"math" | |
) |
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
export default function dataURItoBlob (base64) { | |
const byteString = window.atob(base64) | |
const mimestring = 'image/jpeg' | |
const content = [] | |
for (let i = 0; i < byteString.length; i++) { | |
content[i] = byteString.charCodeAt(i) | |
} | |
return new window.Blob([new Uint8Array(content)], {type: mimestring}) | |
} |
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 | |
// Run the following command | |
// $ time go run main.go | |
// Golang Benchmark | |
// real 0m8.102s | |
// user 0m1.004s | |
// sys 0m0.504s |
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 | |
// Run the following command | |
// $ time go run main.go | |
// Golang Benchmark | |
// real 0m8.102s | |
// user 0m1.004s | |
// sys 0m0.504s |
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 isogram | |
import ( | |
"testing" | |
) | |
// booB #2nd order isogram | |
// Caucasus # 2nd order isogram | |
// geggee # 3rd order |
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 isogram | |
import ( | |
"strings" | |
) | |
func IsIsogram(s string) bool { | |
if s == "" { | |
return false | |
} |
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
/* | |
```html | |
<img data-src="/path/to/image.jpg" alt=""> | |
``` | |
```css | |
img { |
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 ( | |
"encoding/json" | |
"log" | |
"net/http" | |
"reflect" | |
"time" | |
"github.com/gorilla/context" |
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
export default class Dispatcher { | |
constructor() { | |
this._events = []; | |
this._service = []; | |
} | |
on(action, fn) { | |
if (!action) throw new Error('DispatcherError: Missing variable' + action + ' is not defined'); |