Skip to content

Instantly share code, notes, and snippets.

Avatar

Marius A mariusa

View GitHub Profile
@mariusa
mariusa / Staff.html
Last active Jul 1, 2019
NodeX code sample: Render staff users list in front-end
View Staff.html
<div v-if="users.length">
<table class="table table-stripedno table-borderless table-hover">
<thead>
<tr>
<th style="min-width: 8em;">Name</th>
<th>Email</th>
<th>Permissions</th>
<th>Last signin</th>
</tr>
</thead>
@mariusa
mariusa / Staff.vue.js
Last active Jul 1, 2019
NodeX code sample: Load data in front-end from back-end API
View Staff.vue.js
async loadData () {
let res = await axi.get("/api/staff")
this.users = res.data
},
@mariusa
mariusa / api-users.js
Last active Feb 9, 2020
NodeX code sample: Back-end API for reading users list in Manage staff
View api-users.js
//limit to users with 'Administrator' permission
app.get('/api/staff', Common.ensureAuthenticated('Administrator'), async (req, res) => {
let dbres = await dbquery(
`SELECT id, title, first_name, last_name, name, email, phone, role, permissions, last_signin_date
FROM users WHERE org_id=? ORDER BY role, first_name`,
[req.user.org_id]
)
res.json(dbres.rows)
})
@mariusa
mariusa / send-email.js
Created Jul 1, 2019
NodeX code sample: send email
View send-email.js
let email = {
to: u.email,
name: u.name,
subject: 'Your newsletter',
substitution_data: {
first_name: u.first_name,
unsubscribe_link: 'https://' + process.env.APP_HOSTNAME + '/api/unsubscribe?u=' + u.id + '&t=' + u.unsubscribe_token,
highlights: Common.nl2br(highlights_html)
},
body: `Hey {{first_name}},
View setup.sh
echo "SystemMaxUse=50M" >> /etc/systemd/journald.conf
# dropbox
echo "fs.inotify.max_user_watches=100000" >> /etc/sysctl.conf
#cleanup. Watch the deps!!
dnf erase 'adobe-source-*' anthy-9100h audit ceph-libs crash
dnf erase empathy evolution evince fluid-soundfont-gm foomatic-db-ppds
dnf erase gnome-getting-started-docs gutenprint gvfs-gphoto2 gucharmap iok 'hplip*' 'kde*' libpurple
View special-offers-setup.txt
after
{{item.variant.title}}
add
<span class="saso-cart-item-discount-notes" data-key="{{item.key}}"></span>
<span class="saso-cart-item-upsell-notes" data-key="{{item.key}}"></span>
==
View mobile-show-hide.css
.mobile-show {
display: none;
}
@media (max-width: 640px) {
.mobile-show {
display: inline;
}
.desktop-show {
View wholesale-cart.liquid
{% include 'saw_compute_discount' with item.product %}
{% include 'saw_variant' with item.variant %}
{% if saw_has_discount == false or saw_variant_price >= saw_variant_compare_at_price %}
{{ item.price | money }}
{% else %}
{{ saw_variant_price | round | money }}<br>
<del>{{ saw_variant_compare_at_price | money }}</del>
<!-- line_price:
View wholesale-theme.liquid
theme.liquid
{% if customer.tags == blank %}{% else %}
<script>
{% if template != 'cart' %}
jQuery(function(){
jQuery('body').on('click', "input[name='checkout'], input[value='Checkout'], button[name='checkout'], input[name='goto_pp'], button[name='goto_pp'], input[name='goto_gc'], button[name='goto_gc'], [href$='checkout']", function(e){
e.preventDefault();
window.location = "/cart";
View osx-dev.md
You can’t perform that action at this time.