Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Diogo Gomes Alphabetus

🎯
Focusing
View GitHub Profile
@Alphabetus
Alphabetus / pet.rb
Created Jan 4, 2019
commit for exercise 3.5
View pet.rb
class Pet
#attr handler
attr_reader :color, :breed
attr_accessor :name
#init method
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
View functions.php
// PHOTO PLANT ################################################################################################################
function photoPlant($pID){
// db
include "includes/dbConfig.php";
// init
$out = null;
// gen hash
$varA = microtime();
$varB = time();
$varC = $varA . $varB;
@Alphabetus
Alphabetus / rockGame.rb
Created Jan 9, 2019
Rock, Paper, Scissors game
View rockGame.rb
puts "Welcome to Rock, paper or scissors... I actually tried to do a blackjack but i got stuck on arrays... i believe ill get to that with a bit more of knowledge.\n\n"
puts "Alright... give me 'rock', 'paper' or 'scissors'."
puts "You can also choose to 'quit' the game.\n\n"
answer = gets.chomp
case answer.downcase
when "quit"
puts "Alright... game will quit. Bye.\n\n"
return
when "rock", "paper", "scissors"
@Alphabetus
Alphabetus / index.html
Created Feb 6, 2019
simple 100% bootstrap responsive grid template
View index.html
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Bootstrap Grid</title>
<!-- bs call -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
</head>
@Alphabetus
Alphabetus / registrations_controller.rb
Created Feb 8, 2019
[DEVISE] Overriding Registrations Controller
View registrations_controller.rb
# this file should be into "/controllers/"
# We call RegistrationsController extending Devise Registrations controller for starters
class RegistrationsController < Devise::RegistrationsController
# we override the method to define whatever we want here.
def after_update_path_for(resource)
edit_registration_path(resource)
end
@Alphabetus
Alphabetus / geo_distance.js
Last active Mar 13, 2019 — forked from ed-flanagan/geo_distance.js
Great-circle distance formulas in JavaScript
View geo_distance.js
var earth_radius_km = 6371.0;
function deg_to_rad(deg) {
return (deg * Math.PI / 180.0);
}
function haversine_distance(latitude1, longitude1, latitude2, longitude2) {
var lat1 = deg_to_rad(latitude1);
var lng1 = deg_to_rad(longitude1);
var lat2 = deg_to_rad(latitude2);
View not ready
// SETTINGS
slider_settings = {
verbose: true,
verbose_name: "DOBBY",
navigation: true,
bullets: true
}
// post DOM load stuff
$(document).ready(function(){
View gist:d34fcde8305f4238ffb31dcf294cbcca
# DIFF REPORT:# 12-05-2019 16:02:20
# dif number 1
---
:title: "New slideshow options for Boundless theme \U0001F3DE️\U0001F306"
:dates:
:generated_at: 12.12.2019 - 16:02:20
:post_date: March 27, 2019
:meta:
:tag: Themes
@Alphabetus
Alphabetus / gist:000f9f7461ce0136f480945ce0c31dc1
Last active Jun 25, 2019
Selectize.js update custom tax container
View gist:000f9f7461ce0136f480945ce0c31dc1
jQuery('.single-option-selector').selectize({
{% if shop.currency_code == "EUR" %}
{% assign money_symbol = "€" %}
{% endif %}
{% if shop.currency_code == "USD" %}
{% assign money_symbol = "$" %}
{% endif %}
View clear-sidekiq-jobs.sh
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs