Skip to content

Instantly share code, notes, and snippets.

View daliborgogic's full-sized avatar
:octocat:
In Git we trust!

Dalibor Gogic daliborgogic

:octocat:
In Git we trust!
View GitHub Profile
@daliborgogic
daliborgogic / function.php
Last active June 1, 2017 11:18
WP REST API v2
// 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;
}
object foo {
def main(args: Array[String]): Unit = {
println("Srecan Rodjendaaaan!")
}
}
@daliborgogic
daliborgogic / html-css-cheat-sheet.markdown
Last active July 29, 2016 09:29
HTML/CSS Cheat Sheet
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) => {
@daliborgogic
daliborgogic / index.js
Created August 5, 2016 16:44
Get User by Email
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)
})
})
@daliborgogic
daliborgogic / iso-4217.json
Last active September 4, 2016 18:38
ISO 4217 International Standard for currency codes
[
{
"entity": "ALGERIA",
"currency": "Algerian Dinar",
"alphabeticCode": "DZD",
"numericCode": "012",
"minorUnit": "2"
},
{
"entity": "AMERICAN SAMOA",
@daliborgogic
daliborgogic / iso-3136.json
Last active September 4, 2016 19:28
ISO 3166 Countries with Regional Codes. English name, numeric country code and alpha-2 code
[
{
"name":"Afghanistan",
"alpha-2":"AF",
"country-code":"004"
},
{
"name":"Åland Islands",
"alpha-2":"AX",
"country-code":"248"
@daliborgogic
daliborgogic / timezones.json
Created September 4, 2016 19:34
Timezones
[
{
"value": "Dateline Standard Time",
"abbr": "DST",
"offset": -12,
"isdst": false,
"text": "(UTC-12:00) International Date Line West",
"utc": [
"Etc/GMT+12"
]
@daliborgogic
daliborgogic / iso-3136-2json
Last active September 16, 2016 12:45
ISO 3166-2
{
"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",
@daliborgogic
daliborgogic / filters.js
Last active April 25, 2017 15:50
Pug filter stylus
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, '')
})