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 | |
// Output screenshot: | |
// http://cl.ly/NsqF | |
// ------------------------------------------------------- | |
include_once 'console.php'; | |
// ::log method usage | |
// ------------------------------------------------------- | |
Console::log('Im Red!', 'red'); |
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 { Either, Left, Right, match } from './patterns.ts'; | |
interface Person { | |
name: string; | |
} | |
const readValueFromAPI = (): Either<Error, Person> => { | |
// ... | |
const person: Person = { | |
name: 'Test', |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input type="password" name="password"> |
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
ipc.on('channel:enqueue', (e, payload) => { | |
const { channelName, stack, id } = payload; | |
getQueue() | |
.channel(channelName) | |
.enqueue( | |
() => { | |
return new Promise(resolve => { | |
ipc.once(`channel:resolve:${id}`, resolve); | |
e.sender.webContents.send(`channel:execute:${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
enum SomethingOrNothing<T> { | |
Something(T), | |
Nothing, | |
} | |
use self::SomethingOrNothing::*; | |
use std::io::prelude::*; | |
use std::io; | |
pub trait Minimum: Copy { |
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 Cart { | |
export function test1() { | |
console.log('hi'); | |
} | |
export function test2() { } | |
} | |
function curryModule<T>(mod: T): T { | |
return Object | |
.keys(mod) |
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
// By Sallar Kaboli | |
import { sortBy, at } from 'lodash'; | |
export function sortDeepByKey(list, sortKey, childrenKey) { | |
if (!sortKey || !childrenKey) { | |
throw new Error('Insufficient data provided for sorting'); | |
} | |
return sortByKey(list, sortKey).map(item => { | |
return { | |
...item, |
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
const nodemailer = require('nodemailer'); | |
const aws = require('aws-sdk'); | |
// create Nodemailer SES transporter | |
const transporter = nodemailer.createTransport({ | |
SES: new aws.SES({ | |
apiVersion: '2010-12-01', | |
region: 'eu-west-1' | |
}) | |
}); |
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
const { normalize, Schema, arrayOf } = require('normalizr'); | |
const { v4 } = require('uuid'); | |
const group = new Schema('groups'); | |
const groups = arrayOf(group); | |
group.define({ | |
children: groups | |
}); |
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 reducer(state = []) { | |
return [...state, { | |
title: "Test", | |
completed: false | |
}]; | |
} |
NewerOlder