Skip to content

Instantly share code, notes, and snippets.

View codev0's full-sized avatar
💪
Harder, Better, Faster, Stronger

Airat Zhanshuakov codev0

💪
Harder, Better, Faster, Stronger
View GitHub Profile
@codev0
codev0 / restful.js
Created February 5, 2018 04:18 — forked from BinaryMuse/restful.js
Express API with Async/Await
import express from "express";
/**
* Takes a route handling function and returns a function
* that wraps it after first checking that the strings in
* `reserved` are not part of `req.body`. Used for ensuring
* create and update requests do not overwrite server-generated
* values.
*/
function checkReservedParams(routeHandler, ...reserved) {
@codev0
codev0 / steps.md
Created January 18, 2018 18:28 — forked from travisvalentine/steps.md
Setup Facebook app to test authentication locally (aka, setting up App Domain)

Note: I had issues with setting up my Facebook app so authentication would work. I'd receive the error at the bottom, and it took me a while to figure out what was wrong

Here are the steps I took:

  • Go to http://developers.facebook.com/, create, and setup your app
  • When inside the dashboard, click "Settings"
  • Click "Add Platform"
  • Choose website (for authentication via the web app)
  • Add http://localhost:3000/ as "Site URL" (and "Mobile URL" if necessary)
  • Add localhost to "App Domains" above
@codev0
codev0 / node.twig.html
Created December 11, 2017 19:43 — forked from leahtard/node.twig.html
Get file url in node for Drupal 8 twig template
{# Get URL of single file field #}
{{ node.field_file.entity.uri.value }}
{# Get URL of multi file field #}
{{ node.field_file['#items'].entity.uri.value }}
{# Trun into link #}
{{ file_url(node.field_file.entity.uri.value) }}
{# Check if there is at least one value #}
@codev0
codev0 / default-csrf.js
Created September 7, 2017 19:30 — forked from nathanharper/default-csrf.js
axios default CSRF Token
let csrfToken = 'lololololol';
let axiosDefaults = require('axios/lib/defaults');
axiosDefaults.headers.common['X-CSRF-Token'] = csrfToken;
@codev0
codev0 / gist:79a2a49666f1534d8bba
Created March 15, 2016 19:50 — forked from belsrc/gist:672b75d1f89a9a5c192c
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];