This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from "vue"; | |
import VeeValidate from "vee-validate"; | |
import VueSweetalert2 from "vue-sweetalert2"; | |
import VModal from "vue-js-modal"; | |
import router from "./router"; | |
import store from "./store/index.js"; | |
import wysiwyg from "vue-wysiwyg"; | |
import VueSVGIcon from "vue-svgicon"; | |
import PrettyCheckbox from "pretty-checkbox-vue"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// store/modules/hours.js | |
import axios from "axios"; | |
const state = { | |
selectedHourOfOperation: null, | |
activeHourOfOperationModal: false | |
}; | |
const getters = { | |
currentHourOfOperation: state => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/store/index.js | |
import Vue from "vue"; | |
import Vuex from "vuex"; | |
import pages from "./modules/pages"; | |
import employees from "./modules/employees"; | |
import events from "./modules/events"; | |
import locations from "./modules/locations"; | |
import menus from "./modules/menus"; | |
import menusSections from "./modules/menu-section"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SalesService | |
def initialize(product, full_name, email, shop_hacker_merchant_id) | |
@options = { | |
sale: { | |
shop_hacker_product_id: product.shop_hacker_product_id, | |
customer_full_name: full_name, | |
customer_email: email, | |
merchant_id: shop_hacker_merchant_id | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Titleize do | |
def render(words) do | |
String.split(words) | |
|> Enum.map(fn word -> String.capitalize(word) end) | |
|> Enum.join(" ") | |
end | |
end | |
Titleize.render("how to learn elixir") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const stringCleaner = str => { | |
const strWithoutCharacters = str.replace(/[^A-Z0-9]/gi, ""); | |
return strWithoutCharacters.toLowerCase(); | |
}; | |
const buildCharacterMap = str => { | |
const chars = str.split(""); | |
const charMap = chars.reduce((obj, char) => { | |
obj[char] ? obj[char]++ : (obj[char] = 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import os | |
>>> import binascii | |
>>> binascii.b2a_hex(os.urandom(128)) | |
'e681416513db7251edeae16a932971c83410d3f9c5acc1acad6349f210e8442d357bb316599e2f17fbc6a3f714268cb920aba5f24604c7d021652a8c998e9fe7212562ffc19e4b022b63587c0cff7a620db6f43879fd04823b12a6820af13479ac7c218dafb919116d239f83378e28fc09fea75c84e5fa3ca84c862afa440f1d' | |
>>> binascii.b2a_hex(os.urandom(10)) | |
'082084d986ac5cff7da2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toCapital = str => { | |
const words = str.split(" "); | |
return words.map(word => word[0].toUpperCase() + word.slice(1)).join(" "); | |
}; | |
const shortStr = "Hi there"; | |
toCapital(shortStr); // Hi There | |
const longStr = "the quick brown fox jumped over the lazy dog"; | |
toCapital(longStr); // The Quick Brown Fox Jumped Over The Lazy Dog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> require 'image_optimizer' | |
# => true | |
> ImageOptimizer.new('features-img.jpg', quality: 25).optimize | |
# => features-img.jpg 1400x933 24bit P Exif IPTC XMP ICC Adobe [OK] 1111484 --> 92211 bytes (91.70%), optimized. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isEqual = (obj1, obj2) => { | |
const obj1Keys = Object.keys(obj1); | |
const obj2Keys = Object.keys(obj2); | |
if (obj1Keys.length !== obj2Keys.length) { | |
return false; | |
} | |
for (let objKey of obj1Keys) { | |
if (obj1[objKey] !== obj2[objKey]) { |