Skip to content

Instantly share code, notes, and snippets.

View aziflaj's full-sized avatar
🐍
There's a snake in my boot!

Aldo Ziflaj aziflaj

🐍
There's a snake in my boot!
View GitHub Profile
package main
import "fmt"
type Coord struct {
Row int
Col int
}
type Cell struct {
<div id="slot-creation-modal" class="modal">
<%= form_with model: Slot.new, html: { class: 'new-slot' } do |f| %>
<div class="modal-content">
<h4>Create a new slot</h4>
<div class="row">
<div class="input-field col s12">
<i class="material-icons prefix">date_range</i>
<%= f.text_field :scheduled_at_date, class: 'datepicker', placeholder: 'Scheduled date' %>
</div>
def initial_letter(rules)
lefts = []
rights = []
rules.each do |rule|
left, right = rule.chars
lefts << left
rights << right
end
lefts.each do |chr|
def deep_search(key, params, found = nil)
return params.fetch(key) if params.has_key?(key)
params.each_pair do |_, v|
next unless v.is_a? ActionController::Parameters
found = deep_search(key, v)
end
found
end
def flatten(arr, level = 1)
r = arr.each_with_object([]) do |item, result|
if item.is_a?(Array)
item.each { |i| result << i }
else
result << item
end
end
return flatten(r, level - 1) if level.positive?
r
# frozen_string_literal: true
source "https://rubygems.org"
# gem "rails"
gem 'thor'
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/ubuntu1404-x64
box_url: puphpet/ubuntu1404-x64
box_version: '0'
chosen_virtualizer: virtualbox
virtualizers:
@aziflaj
aziflaj / calendar.c
Last active February 23, 2016 20:46
Some small C programs written as homeworks
/*
* wap
* kalendari per 1 muaj
* perdoruesi jep vitin dhe muajin
*/
#include <stdio.h>
int main(int argc,char **argv) {
char* s_muaji[] = {"Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nentor","Dhjetor"};
@aziflaj
aziflaj / calculator.cpp
Created February 23, 2016 20:41
A simple calculator written in C++
/*
Name: CALCULATOR v1.0
Author: Aldo Ziflaj
Date: 01-01-13 12:01
Description: A simple calculator that can add, subtract multiply, divide,
raise to n-th integer power and calculate the factorial
*/
#include <iostream>
#include <cstdio>
@aziflaj
aziflaj / AddressBook.c
Created February 23, 2016 20:39
An address book manager written in C as a homework
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX 100
struct PERSON {
char fName[20]; /* emri i nje personi ne librin e adresave */
char lName[20]; /* mbiemri i nje personi ne librin e adresave */
char id[20]; /* ID i nje personi ne librin e adresave */