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" | |
"log" | |
"net/http" | |
) | |
func main() { | |
fs := http.FileServer(http.Dir("./")) |
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 Cocoa | |
let context = CIContext() | |
let lidimg = NSImage(named: "lid")?.cgImage(forProposedRect: nil, context: nil, hints: nil) | |
let originalCIImage = CIImage(cgImage: lidimg!) | |
func perspFilter(_ input: CIImage) -> CIImage? |
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
// <input type="text" id="iban"> | |
document.getElementById('iban').addEventListener('input', function (e) { | |
var target = e.target, position = target.selectionEnd, length = target.value.length; | |
target.value = target.value.replace(/[^\dA-Za-z]/g, '').replace(/(.{4})/g, '$1 ').trim(); | |
if(e.inputType === 'deleteContentForward') { | |
target.selectionEnd = position += ((target.value.charAt(position) === ' ') ? 1 : 0); | |
} else { | |
target.selectionEnd = position += ((target.value.charAt(position - 1) === ' ' && target.value.charAt(length - 1) === ' ' && length !== target.value.length) ? 1 : 0); | |
if(target.selectionEnd % 5 === 0) { |
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> | |
<head> | |
<title>Browser-History Push/Pop</title> | |
</head> | |
<body> | |
<form id="myform"> | |
<label> |
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" | |
"fmt" | |
) | |
type Fleet struct { | |
Cars []Car | |
Countries []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
'use strict'; // avoid ambiguity and sloppy errors | |
/** | |
* Tests whether or not a given string is a Palindrome | |
* @param {string} stringToTest - the string to test. | |
*/ | |
function isPalindrome(stringToTest) { | |
var start = 0, | |
end; |
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
UIGraphicsBeginImageContextWithOptions(myView.bounds.size, true, 0) | |
myUiView.drawViewHierarchyInRect(myView.bounds, afterScreenUpdates: true) | |
let myImage = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
UIImageWriteToSavedPhotosAlbum(myImage, nil, nil, nil) |
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
$('[data-accordion-toggler]').on("click", function () { | |
$(this).next().toggle(); | |
$('[data-toggle-content]').not($(this).next()).hide(); | |
}); |
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
<img src="" data-src="myphoto.jpg" class="js-lazyload" alt="Photo"> | |
<noscript> | |
<img src="myphoto.jpg" alt="Photo"> | |
</noscript> | |
<script> | |
var images = document.getElementsByClassName("js-lazyload"); | |
for(var i = 0; i < images.length; i++) { | |
images[i].attributes.src.value = images[i].attributes["data-src"].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
.container { | |
position: relative; | |
overflow: hidden; | |
&:after { | |
position: absolute; | |
content: ' '; | |
width: 100%; |
NewerOlder