Skip to content

Instantly share code, notes, and snippets.

View cannap's full-sized avatar
💥
Working from home

Marko Bolliger cannap

💥
Working from home
View GitHub Profile
const { ServiceProvider } = require('@adonisjs/fold')
class SettingsProvider extends ServiceProvider {
register () {
// Register Model
this.app.singleton('Renka/Setting/Model', () => {
const Option = require('./Models/Option')
Option._bootIfNotBooted()
return Option
})
const { ServiceProvider } = require('@adonisjs/fold')
class SettingsProvider extends ServiceProvider {
register () {
// Register Model
this.app.bind('Renka/Setting/Model', () => require('./Models/Option'))
this.app.singleton('Renka/SettingManager', () => {
// Todo: Use Config
return new (require('./SettingsManager.js'))({ preload: true })
})
@cannap
cannap / greg
Created December 20, 2017 14:37
{
"name": "ecommerce",
"version": "4.0.0",
"adonis-version": "4.0.0",
"description": "The fullstack application boilerplate for Adonisjs",
"main": "index.js",
"scripts": {
"start": "node server.js",
"test": "node ace test --timeout=0",
"dev": "adonis serve --dev --watch=app,config,start",
const URLpattern = /http(?:s)?:\/\/|www\./g
//bunch of crap code starts here
// i will refactor this next year :D
function generateBC(url, separator) {
var url = url.replace(URLpattern, '');
const urlArr = parseURL(url);
var path = finalClean(urlArr.path);
const pathLength = path.length;
var output = "";
<template>
<b-modal @ok="submitCategory" @hidden="$store.dispatch('modals/toggleModal', 'categoryModal')" :visible="$store.state.modals.categoryModal" :title="title">
<b-form>
<b-form-group label="Name">
<b-form-input @input="changeSlug" type="text" v-model="category.name" required/>
</b-form-group>
<b-form-group label="Slug">
<b-form-input type="text" v-model="category.slug" required/>
</b-form-group>
<?php
class Additional_Duplicating_Price {
private $duplicating_field = 'duplicating';
private $free_from = 8;
private $duplicating_price = 1;
public function __construct() {
@cannap
cannap / fefe.js
Created September 27, 2017 18:25
const Service = require('./Service')
const createThrottle = require('async-throttle')
class CreateRest extends Service {
constructor () {
super()
this.content = {
body: { wtf: 'fwef' }
}
}
function iconic_output_engraving_field() {
global $product;
if ( ! check_user_role( 'gewerbe' ) )
return;
?>
<hr>
<div class="iconic-engraving-field">
<p class="form-row legal terms wc-terms-and-conditions">
<input type="checkbox" class="input-checkbox" name="duplicating" id="duplicating">
@cannap
cannap / test.js
Created September 23, 2017 23:29
if (!content.hasOwnProperty('checksum_type')) {
return {
forPaypal () {
console.log(content)
},
forSofort () {}
}
}
@cannap
cannap / Test.js
Created September 17, 2017 18:18
var UserService = make('App/Services/UserService')
class AuthController {
async login ({ request, response, auth }) {
UserService.demo()
const { email, password } = request.all()
try {
const token = await auth.attempt(email, password)
response.send(token)
} catch (error) {