Skip to content

Instantly share code, notes, and snippets.

Avatar

Rouven Bühlmann nirazul

View GitHub Profile
View theme_2.css
body {
background-color: blue;
}
View theme_1.css
body {
background-color: red;
}
@nirazul
nirazul / keybase.md
Created Sep 16, 2019
Keybase verification
View keybase.md

Keybase proof

I hereby claim:

  • I am nirazul on github.
  • I am nirazul (https://keybase.io/nirazul) on keybase.
  • I have a public key ASAAPS3-3WqInsgTBGJyh4kQmfJIcGdQtwHOCeeB9JAlpQo

To claim this, I am signing this object:

@nirazul
nirazul / map-filters.js
Created Jun 4, 2017
Map global filters to local methods to use them in components as well as templates
View map-filters.js
/**
* Map global filters for being used from within `methods`. This makes them usable in js as well as templates
* @param {Array} filters - A list of registered filter names
* @return {Object) An object containing filters and their functions
*/
export function mapFilters(filters) {
return filters.reduce((result, filter) => {
result[filter] = function(...args) {
return this.$options.filters[filter](...args);
};
@nirazul
nirazul / index.js
Created May 5, 2017
blog.dreipol.ch - Snippet 9
View index.js
function getRouteData({ commit, state, dispatch }, { url }) {
let FetchPromise = state.routes[url];
if (FetchPromise) {
return FetchPromise;
}
return new Promise((resolve, reject) => {
Axios.request({ url }).then(
(request) => {
@nirazul
nirazul / index.js
Last active May 5, 2017
blog.dreipol.ch - Snippet 8
View index.js
function setEndpoint(store, presets) {
return function fetch(route) {
// 1. Merge params and query with route presets
const params = Object.assign({}, presets.params, route.params);
const query = Object.assign({}, presets.query, route.query);
// 2. Create compiled endpoint url
const url = compileUrl(presets.url, params, query);
// 3. Push available data into the store's endpoint address
@nirazul
nirazul / index.js
Last active May 5, 2017
blog.dreipol.ch - Snippet 7
View index.js
export default {
beforeRouteEnter(to, from, next) {
const Fetched = to.meta.api.fetch(to.params, to.query);
next(vm => Fetched.then((vm) => {
vm.$set(vm, 'routeData', fetched);
});
},
beforeRouteUpdate(to, from, next) {
const Fetched = to.meta.api.fetch(to.params, to.query);
Fetched.then(() => {
@nirazul
nirazul / index.json
Created May 5, 2017
blog.dreipol.ch - Snippet 6
View index.json
{
"fetched": {
"partials": {
"menu": {
"content": {},
}
}
}
}
@nirazul
nirazul / index.json
Created May 5, 2017
block.dreipol.ch - Snippet 5
View index.json
"plugins": [
{
"content": {
"src": "static/assets/img/alpaca.img",
"alt": "Alpaca grazing"
},
"type": "cmp-image"
}
]
@nirazul
nirazul / index.json
Created May 5, 2017
blog.dreipol.ch - Snippet 4
View index.json
{
"fetched": {
"containers": {
"home": {
"plugins": [],
"type": "cmp-home"
},
"main": {
"plugins": [],
"type": "cmp-main"