Skip to content

Instantly share code, notes, and snippets.

View chhumsina's full-sized avatar
🌧️
Raining now!

CHHUM Sina chhumsina

🌧️
Raining now!
  • Phnom Penh
View GitHub Profile
@chhumsina
chhumsina / permission.js
Created May 4, 2020 04:02
Check permission directive for nuxtjs
import Vue from 'vue'
export default function({ store }, inject) {
Vue.directive('permission', {
inserted(el, binding, vnode) {
const { permission } = binding
const permissionList = store.state.auth.user.permission
if (permission && Array.isArray(permission) && permission.length > 0) {
const hasPermission = permissionList.some((role) => {
@chhumsina
chhumsina / auth.js
Created April 22, 2020 07:18 — forked from zolotyx/auth.js
Nuxt Auth Redirect Fix
export const isSameURL = (a, b) => a.split('?')[0] === b.split('?')[0]
export const isRelativeURL = u =>
u && u.length && /^\/[a-zA-Z0-9@\-%_~][/a-zA-Z0-9@\-%_~]*[?]?([^#]*)#?([^#]*)$/.test(u)
export default function ({ app }) {
const redirect = function (name, noRouter = false) {
if (!this.options.redirect) {
return
}
<script>
// vuejs with crypto-js - AES256 encrypt | decrypt api login
import CryptoJS from 'crypto-js'
import axios from 'axios'
import format from 'date-fns/format'
const key = '82f2ceed4c503896c8a291e560bd4325' // change to your key
const iv = 'sinasinasisinaaa' // change to your iv
const apiKey = '123xxxyyyzzz' // change to your api key
const username = 'chhumsina'
<script>
import { Doughnut } from "vue-chartjs";
import Chart from "chart.js";
export default {
extends: Doughnut,
data: () => ({
chartdata: {
labels: ["Cambodia", "Thailand", "Vietnam", "Laos"],
datasets: [
@chhumsina
chhumsina / .eslintrc
Created March 21, 2020 04:30
Setup Eslint + Prettier in an existing vue-cli project- eslintrc file- user settings in VsCode- package.json (for check versions)
// Eslint + Prettier, custom configuration taken from here.
// https://medium.com/@doppelmutzi/eslint-prettier-vue-workflow-46a3cf54332f
// and here's my gist
// https://gist.github.com/robertoandres24/6cb6d0fa898bfb31066c5e1b118df64a
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: {
@chhumsina
chhumsina / code.md
Created January 9, 2020 04:58 — forked from gopalindians/code.md
Jetbrains IntelliJ IDEA 2019.2.4 Activation code

Please make fork of this, as this can be removed by Github.com sooner or later.

CATF44LT7C-eyJsaWNlbnNlSWQiOiJDQVRGNDRMVDdDIiwibGljZW5zZWVOYW1lIjoiVmxhZGlzbGF2IEtvdmFsZW5rbyIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiQUMiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEUE4iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQUyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IkdPIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJTMCIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiUkQiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJQQyIsInBhaWRVcFRvIjoiMjAyMC0wMS0wOCJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDIwLTAxLTA4In0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMjAtMDEtMDgifSx7ImNvZGUiOiJEQiIsI

@chhumsina
chhumsina / contact_data.dart
Created February 24, 2019 07:43 — forked from fabiomsr/contact_data.dart
Contact data
import 'dart:async';
import 'package:intl/intl.dart';
class Contact {
static final DateFormat _formatter = DateFormat('MMMM d, yyyy');
final String fullName;
final String gender;
@chhumsina
chhumsina / Instructions.md
Created August 31, 2018 04:23 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example

alert('hello');
<div id="itemlist">
<div class="feed_item">
<div class="feed_item_title">
<a target="_blank" href="http://www.ezekhmer.com/2014/10/nouislider-sliding-range-of-beautiful.html">noUiSlider - beautiful of Sliding range style</a></div>
<div class="feed_item_description">
noUiSlider is a range slider without bloat . It offers a ton off features , and it is as small, lightweight and minimal as possible, which is great...
</div>
<div class="feed_item_date">Oct 17, 2014 8:16:53 AM</div>
</div>
</div>