A Pen by Dalibor Gogic on CodePen.
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
// WP REST API v2 | |
// Prepare Pages | |
add_filter('rest_prepare_page', 'remove_extra_data', 12, 3); | |
function remove_extra_data($data, $post, $context) { | |
if ($context !== 'view' || is_wp_error ($data)) { | |
unset ($data->data['excerpt']); | |
// ... | |
return $data; | |
} |
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
object foo { | |
def main(args: Array[String]): Unit = { | |
println("Srecan Rodjendaaaan!") | |
} | |
} |
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
app.route('/users') | |
.post((req, res) => { | |
User.count({email: req.body.email}, function (err, count) { | |
if (count == 0) { | |
// email doesn't exist | |
const user = new User() | |
user.email = req.body.email | |
user.newsletter = req.body.newsletter | |
user.save((err) => { |
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
app.route('/v1/users/:email') | |
// GET https://api.example.com/v1/users/:email | |
.get((req, res) => { | |
User.find({ email: req.params.email}, (err, user) => { | |
if (err) throw err | |
res.json(user) | |
}) | |
}) |
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
[ | |
{ | |
"entity": "ALGERIA", | |
"currency": "Algerian Dinar", | |
"alphabeticCode": "DZD", | |
"numericCode": "012", | |
"minorUnit": "2" | |
}, | |
{ | |
"entity": "AMERICAN SAMOA", |
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
[ | |
{ | |
"name":"Afghanistan", | |
"alpha-2":"AF", | |
"country-code":"004" | |
}, | |
{ | |
"name":"Åland Islands", | |
"alpha-2":"AX", | |
"country-code":"248" |
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
[ | |
{ | |
"value": "Dateline Standard Time", | |
"abbr": "DST", | |
"offset": -12, | |
"isdst": false, | |
"text": "(UTC-12:00) International Date Line West", | |
"utc": [ | |
"Etc/GMT+12" | |
] |
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
{ | |
"AF":{ | |
"name":"Afghanistan", | |
"divisions":{ | |
"AF-BDS":"Badakhshān", | |
"AF-BDG":"Bādghīs", | |
"AF-BGL":"Baghlān", | |
"AF-BAL":"Balkh", | |
"AF-BAM":"Bāmīān", | |
"AF-FRA":"Farāh", |
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
module.exports = { | |
filters: { | |
stylus: function (str, opts) { | |
let ret | |
str = str.replace(/\\n /g, '') | |
const styl = require('stylus') | |
styl(str, opts).render(function (err, css) { | |
if (err) throw err | |
ret = css.replace(/\s/g, '') | |
}) |