See this in action using plunker http://plnkr.co/edit/gist:9cb51ae670de20255dcc?p=preview
This file contains hidden or 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
const links = Array.from(document.querySelectorAll("tr.athing")).map((elem) => { | |
const { href, innerText } = elem.querySelector(".titleline > a") | |
const links = Array.from(elem.nextElementSibling.querySelectorAll("a")); | |
const commentLink = links[links.length - 1]; | |
return {href, innerText, comment: commentLink.href} | |
}); |
This file contains hidden or 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
const RoomRates = ({ rooms }: { rooms: any }) => { | |
const formatDate = (dateStr:string) => moment(dateStr).format('DD/MM/YYYY') | |
const {formValue} = useContext( LibContext ) | |
console.log('form value', formValue) | |
const groupedRooms = rooms.map((room:any) => { | |
// generate occupancy list first | |
const [occupancyList, _] = room.rates.reduce(([ result, index, groupIdx ], _) => { |
This file contains hidden or 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
// Instruction | |
// | |
// Go to facebook "sent friend requests page" | |
// https://www.facebook.com/friends/requests/?fcref=jwl&outgoing=1 | |
// Then run the script below in your browser console | |
// You might need to click "Cancel Request" only in the very first time | |
// and the rest will be handled by this stupid script. | |
// Unfriend useless crush and have fun :P | |
// a lot more to improve :P |
This file contains hidden or 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 | |
class BaseModel extends Eloquent { | |
public static function shouldReceive() | |
{ | |
$repo = get_called_class() . 'RepositoryInterface'; | |
$mock = Mockery::mock($repo); | |
App::instance($repo, $mock); |
This file contains hidden or 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
Expression | |
= value:Line* { | |
return value; | |
} | |
Line | |
= entity:[a-zA-Z_]+ _ "[" params:(Param)+ "]" _ { | |
return { | |
entity: entity.join(""), | |
params: params |
This file contains hidden or 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 odd( array ) { | |
return _.filter( array, function( v, k ){ return k % 2 !== 0; }); | |
} | |
function even( array ) { | |
return _.filter( array, function( v, k ){ return k % 2 === 0; }); | |
} | |
var makeEqualLength = function( arrays ) { |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
This file contains hidden or 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
/** | |
* creating an array iterate all the days between startDate and endDate | |
* depends on MomentJS | |
*/ | |
function populateDateArray( startDate, endDate ) { | |
var mStartDate = moment( startDate, 'YYYY-MM-DD' ); | |
var mEndDate = moment( endDate, 'YYYY-MM-DD' ); | |
var days = []; var curDate = mStartDate; | |
for ( ; curDate.format('YYYY-MM-DD') != endDate ; curDate = mStartDate.add('days', 1)) { |
This file contains hidden or 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
ML Languages | |
http://smlnj.org | |
Programming in ML |
NewerOlder