Skip to content

Instantly share code, notes, and snippets.

View zechtz's full-sized avatar

Mtabe zechtz

View GitHub Profile
@zechtz
zechtz / upvote.ex
Created April 8, 2024 11:45
Phoenix Downvote Live Component styled using tailwind css
defmodule LiveWeb.Downvote do
use LiveWeb, :live_component
alias Live.FAQs
@impl true
def update(assigns, socket) do
{:ok, assign(socket, assigns)}
end
@impl true
@zechtz
zechtz / dynamic-form.vue
Created July 28, 2020 09:09
Create dynamic form in Vuejs
<template>
<div>
<v-row class="mt-n8" v-for="(stream, index) in streams" :key="index">
<v-col cols="12" lg="5" md="5" sm="12">
<v-select
:items="shiftMetadataNames"
:item-text="'name'"
v-model="stream.shiftMetadataName"
:name="`streams[${index}][shiftMetadataName]`"
return-object
@zechtz
zechtz / ngix-php7-fmp
Created February 2, 2018 14:30
Nginx Configuration with Laravel + PHP7.2 fpm
server {
listen 80;
listen [::]:80;
root /home/username/sites/laravelappdirectory/public;
index index.php index.htm index.nginx-debian.html;
server_name servername.test www.servername.test;
@zechtz
zechtz / dashboard-service.js
Created September 21, 2017 11:57
Dashboard Service
(function() {
'use strict';
var dashboardModels = angular.module('dashboardModels', ['ngResource']);
dashboardModels.factory('DashboardStats', ['$resource', '$http', function($resource, $http) {
return {
/**
@zechtz
zechtz / project-form.html
Created August 8, 2017 11:31
Project Form
<h2>Project Profile Form</h2>
<md-content class="md-default-theme">
<div class="spacer"></div>
<form name="form" class="ab-form" layout="column" novalidate>
<md-content layout-padding layout="row">
<md-input-container flex>
<input type="text"
name="name"
placeholder="Vote Name"
ng-model="report.name"
<div class="new-button md-fab lock-size"
layout="row"
layout-align="center center"
ng-cloak>
<md-fab-speed-dial md-open="isOpen"
md-direction="{{ selectedDirection }}"
ng-class="selectedMode">
<md-fab-trigger>
<md-button aria-label="menu" class="md-fab md-primary">
<ng-md-icon icon="menu"</ng-md-icon>
@zechtz
zechtz / application.rb
Created March 2, 2017 12:11
simple page scrapping utility examle
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module AntiPlag
class Application < Rails::Application
```
def add_uniq number
# convert to a character array
# return only unique charachars to a new array
# looop through each and add
new_number = number.to_s.chars
unique = new_number.uniq
sum = 0
unique.each do |x|
@zechtz
zechtz / solarized-dark.css
Created May 27, 2016 00:56 — forked from nicolashery/solarized-dark.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@zechtz
zechtz / pluck_multiple.rb
Created September 14, 2015 12:12
Pluck Multiple Columns Rails 3
module ActiveRecord
class Relation
def pluck_multiple(*args)
args.map! do |column_name|
if column_name.is_a?(Symbol) && column_names.include?(column_name.to_s)
"#{connection.quote_table_name(table_name)}.#{connection.quote_column_name(column_name)}"
else
column_name.to_s
end
end