Skip to content

Instantly share code, notes, and snippets.

View jcroot's full-sized avatar
🎯
Focusing

Jean Claude Adams jcroot

🎯
Focusing
View GitHub Profile
@jcroot
jcroot / transmogrify.py
Created May 23, 2022 21:34
Improve my code
import json
import time
from datetime import datetime, timezone
# For the raw events given (a List of Dictionaries) returns normalized log events as a List of
# Dictionaries having the following keys: 'server', 'date', 'severity', 'process', 'message'.
def transmogrify(raw_events: [dict]) -> [dict]:
# Write your solution here and in any helper functions you wish to create.
@jcroot
jcroot / Dockerfile
Last active May 4, 2022 16:58
Zend Docker Example
FROM php:7.1-apache
RUN apt-get update \
&& apt-get install -y git zlib1g-dev wget tar \
&& docker-php-ext-install mysqli pdo pdo_mysql gettext zip \
&& a2enmod rewrite \
&& sed -i 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf \
&& sed -i 's!www.example.com!remolques.localhost!g' /etc/apache2/sites-available/000-default.conf \
&& curl -sS https://getcomposer.org/installer \
| php -- --install-dir=/usr/local/bin --filename=composer
$('#capture').on('click', function () {
if (confirm("Esta seguro de guardar este Cartel?")){
$(this).prop("disabled", true);
let message = $(this).html();
$(this).html('<i class="fa fa-spinner fa-spin" aria-hidden="true"></i> Generando...');
html2canvas(document.querySelector('#content-capture')).then(function (canvas) {
let url = "/curate/21/capture";
let name = "228d1aa8f67997062dfa831f4c6f8a59553cd700aced02f5244e6ff4b176b62b";
postCanvas(url, name, canvas, $('#capture'), message);
@jcroot
jcroot / Database.php
Last active April 3, 2021 16:19
Clase Abstracta
<?php
abstract class Database implements DatabaseCRUD {
}
@jcroot
jcroot / clean_code.md
Created February 23, 2021 11:26 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

function logme(mrc)
{
$.ajax({
url : "log.php",
type : "get",
async: false,
data: {
'mrc': mrc
},
success : function(response) {
<?php
$merchant = $_GET['mrc'];
$fc = getdate();
$datetime = $fc['year'].'-'.$fc['mon'].'-'.$fc['mday'].' '.$fc['hours'].':'.$fc['minutes'].':'.$fc['seconds'];
error_log("Merchant: ". $merchant." fechahora: ". $datetime.chr(13), 3, 'log.txt');
@jcroot
jcroot / serveo.sh
Created November 12, 2019 16:53 — forked from BrunIF/serveo.sh
Make own tunneling over SSH based on Serveo
#!/bin/bash
# Change `site.com` - to own name
read SERVER_NAME
sudo -s
# Change codepage
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
# Update and install software
package com.arrobasoft.claxoo.entities;
/**
* Created by jadams on 07/03/2016.
*/
public class SmsItem {
int counter = 0;
int in_out;
String created_at;
String message;
package com.arrobasoft.claxoo.fragments;
import android.app.Activity;
import android.app.Fragment;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.telephony.SmsMessage;