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
Object.keys(obj).length === 0 && obj.constructor=== Object |
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
/* | |
* 60 FPS Scroll | |
* | |
* prevent accidental click on links | |
* prevent other touch-related events | |
* 60fps scroll | |
* | |
* Usage: | |
* import Scroll from './scroll' | |
* Scroll() |
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'); |
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
/* | |
```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 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
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 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
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}) | |
} |
OlderNewer