<button>Let's Go !</button>
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
$('[id]').each(function(){ | |
var ids = $('[id="'+this.id+'"]'); | |
if(ids.length>1 && ids[0]==this) | |
console.warn('Multiple IDs #'+this.id); | |
}); |
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
In web design sometimes you need an «empty» pixel to scale it to the desired length. For this matter I have gathered GIF and PNG both 100% transparent and white (it turns out this has some impact on the file size). | |
The PNGs have been ran through PNGOutWin. JPEGs I could get were above 1 KiB and for this reason are not considered. | |
Get all images in this archive. | |
Details | |
GIF | |
The winner is 1-color GIF – 35 bytes. Data URI for white 1×1 image: |
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
PARENT | |
func = (smh) => { | |
alert(smh) | |
} | |
<ChildComponent func={this.func} /> | |
CHILD | |
pressHandler(smh) { |
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
class ItemViewComponent extends React.Component { | |
render() { | |
return ( <View> {this.displayJsxMessage()} </View> ); | |
} | |
displayJsxMessage() { | |
return {this.props.isGreeting && <Text> Hello, JSX! </Text>} | |
} | |
} |
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
javascript:(function(){var styles = document.querySelectorAll('link[rel=\'stylesheet\']'); for (var s = 0; s < styles.length; s++) {styles[s].mediax = styles[s].media;if (styles[s].media === 'only x') { styles[s].media = styles[s].mediax; } else if (styles[s].media !== 'print') {styles[s].media = 'only x';}}})(); |
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
// Bind up a couple of event handlers | |
$("#foo").on({ | |
click: function(){ alert("Hello") }, | |
mouseout: function(){ alert("World") } | |
}); | |
// Lookup events for this particular Element | |
$._data( $("#foo")[0], "events" ); |
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
var domIsReady = (function(domIsReady) { | |
var isBrowserIeOrNot = function() { | |
return (!document.attachEvent || typeof document.attachEvent === "undefined" ? 'not-ie' : 'ie'); | |
} | |
domIsReady = function(callback) { | |
if(callback && typeof callback === 'function'){ | |
if(isBrowserIeOrNot() !== 'ie') { | |
document.addEventListener("DOMContentLoaded", function() { | |
return callback(); |
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
$(“[attribute|=’value’]”) — The “attribute contains prefix selector” returns all elements with attributes whose value is equal to or starts with the given string followed by a hyphen. | |
$(“[attribute*=’value’]”) — This “attribute contains selector” returns all elements with attributes whose value contains the given substring. The location of the value doesn’t matter. As long as it matches with the given value the selector will select the element. | |
$(“[attribute~=’value’]”) — This selector returns all elements with attributes whose value contains a given word delimited by spaces. | |
$(“[attribute$=’value’]”) — This selector returns all elements with attributes whose value ends with the given string. | |
$(“[attribute=’value’]”) — This selector returns all elements with attributes whose value is exactly equal to a given 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
<?php | |
// requires php5 | |
define('UPLOAD_DIR', 'images/'); | |
$img = $_POST['img']; | |
$img = str_replace('data:image/png;base64,', '', $img); | |
$img = str_replace(' ', '+', $img); | |
$data = base64_decode($img); | |
$file = UPLOAD_DIR . uniqid() . '.png'; | |
$success = file_put_contents($file, $data); | |
print $success ? $file : 'Unable to save the file.'; |