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 to_pennies($value) | |
{ | |
return intval( | |
strval(floatval( | |
preg_replace("/[^0-9.]/", "", $value) | |
) * 100) | |
); | |
} |
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 = 'dog'; | |
$value = match ($name) { | |
'dog' => 1, | |
'cat' => 2, | |
'horse' => 3, | |
default => throw new \Exception, | |
}; |
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 ( | |
"net/http" | |
"encoding/json" | |
) | |
type Person struct { | |
ID int `json:"id"` | |
Firstname string `json:"firstname"` |
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=radio] { | |
position: absolute; | |
top: -9999px; | |
left: -9999px; | |
} | |
label { | |
cursor: pointer; | |
text-align: center; | |
font-family: sans-serif; |
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
On client page | |
```html | |
<re-widget type="youtube" src="https://www.youtube.com/embed/TwAFQZLK79A"></re-widget> | |
<script> | |
(function (fn) { | |
var d = document, s = d.createElement('script'); | |
s.onload = fn; d.head.appendChild(s); s.src = 'embed.js'; | |
})(function () { |
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 | |
namespace Events; | |
class FSBOEvent | |
{ | |
/** | |
* @var array | |
*/ | |
protected static $eventHandlers = []; |
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
{"lastUpload":"2017-12-21T00:08:27.138Z","extensionVersion":"v2.8.7"} |
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
function isPalindrome (str) { | |
str = str.replace(/[^a-zA-Z]/g, '').toLowerCase() | |
var len = Math.floor(str.length / 2) | |
return (str.substring(0, len) === str.substring(len + 1).split('').reverse().join('')) | |
} | |
console.log(isPalindrome('A dog! A panic in a pagoda!')) // true | |
console.log(isPalindrome('Able was I ere I saw Elba.')) // true | |
console.log(isPalindrome('not a palindrome')) // 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
<h1>Pure CSS Star Rating Widget</h1> | |
<fieldset class="rating"> | |
<input type="radio" id="star5" name="rating" value="5" /><label class = "full" for="star5" title="Awesome - 5 stars"></label> | |
<input type="radio" id="star4half" name="rating" value="4 and a half" /><label class="half" for="star4half" title="Pretty good - 4.5 stars"></label> | |
<input type="radio" id="star4" name="rating" value="4" /><label class = "full" for="star4" title="Pretty good - 4 stars"></label> | |
<input type="radio" id="star3half" name="rating" value="3 and a half" /><label class="half" for="star3half" title="Meh - 3.5 stars"></label> | |
<input type="radio" id="star3" name="rating" value="3" /><label class = "full" for="star3" title="Meh - 3 stars"></label> | |
<input type="radio" id="star2half" name="rating" value="2 and a half" /><label class="half" for="star2half" title="Kinda bad - 2.5 stars"></label> | |
<input type="radio" id="star2" name="rating" value="2" /><label class = "full" for="star2" title="Kinda bad - 2 stars" |
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 MyComponent { | |
render () { | |
return ( | |
<h1>My Component</h1> | |
) | |
} | |
} | |
var HelloWorld = function(props) { | |
return ( |
NewerOlder