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 React from 'react'; | |
import PropTypes from 'prop-types'; | |
/** | |
* A box with an animated dashed border, i.e. marching ants | |
*/ | |
export default function MarchingAnts({ | |
width, | |
height, | |
animationDuration = 300, |
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
.adg3 .ghx-column h2 { | |
text-transform: none; | |
font-size: 13px; | |
color: #2e2e2e | |
} | |
.adg3 .ghx-column-headers .ghx-qty { | |
background-color: #18cb3b; | |
color: white; | |
width: 20px; | |
height: 20px; |
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
Benchmarking against 10 iteration(s): | |
--- 1.2MB jpg file --- | |
0.298s - data uri base64_encode() | |
0.701s - data uri urlencode() | |
0.702s - data uri rawurlencode() | |
0.045s - temp file | |
--- 2.5MB jpg file --- | |
0.597s - data uri base64_encode() |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
module.exports = { | |
devtool: 'sourcemap', | |
context: __dirname, | |
entry: './entry.js', | |
output: { | |
filename: './dist/bundle.js' | |
}, | |
module: { | |
loaders: [ | |
// run babel first then ng-annotate |
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
/** | |
* Given a DOM node, clean children so the node is suitable for pasting in a rich text area | |
* @param {HTMLElement} root The DOM node to clean | |
* @param {Object} [options] Cleaning options | |
* @param {object} [options.classMap] A map of tagName to CSS class for assigning classes | |
* @returns {undefined} | |
*/ | |
function cleanElementChildren(root, options) { | |
// options may or may not be given | |
options = 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
/* | |
# Usage in html template: | |
"xxx | nl2br" | |
<div ng-bind-html=" YourString | nl2br "></div> | |
or: |
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 | |
function sendFile($path, $name, $mime) { | |
$fp = @fopen($path, 'rb'); | |
if (!$fp) { | |
// error opening file; it may not exist or be readable | |
header("HTTP/1.0 404 Not Found"); | |
exit(0); | |
} | |
$size = filesize($path); |
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
{ | |
"name": "", | |
"description": "", | |
"version": "0.1.0", | |
"dependencies": {}, | |
"devDependencies": {} | |
} |
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 | |
$foo = castObject($bar, '\\My\\FooObject'); | |
function castObject($obj, $toClass) { | |
if (is_callable("$toClass::__cast")) { | |
return call_user_func("$toClass::__cast", $obj); | |
} | |
if ($obj instanceof $toClass) { | |
return $obj; |
NewerOlder