Skip to content

Instantly share code, notes, and snippets.

View zechtz's full-sized avatar

Mtabe zechtz

View GitHub Profile
@zechtz
zechtz / index.html.erb
Created May 27, 2015 14:30
For Wiseone
<div id="product_list" >
<h1>Listing products</h1>
<table>
<% @products.each do |product| %>
<tr class="<%= cycle('list_line_odd' , 'list_line_even' ) %>" >
<td>
<%= image_tag(product.image_url, :class => 'list_image' ) %>
</td>
<td class="list_description" >
@zechtz
zechtz / form.html
Created September 10, 2015 16:52
Control Show Hide Form elements depending on selected value
<form accept-charset="UTF-8" action="#" class="search_aside" id="advanced_search" method="post">
<div class="row">
<select id="practice_area" name="advanced_search[law_area_id]">
<option value="">Select Area of Practice</option>
<option value="14">Admiralty &amp; Maritime Law</option>
<option value="24">Banking and Finance Law</option>
</select>
</div>
<div class="row">
<select id="advanced_search_country_id" name="advanced_search[country_id]"><option value="">Select Country</option>
@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
@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
```
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 / 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
<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 / 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"
@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 / 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;