Skip to content

Instantly share code, notes, and snippets.

👨‍🎓
I may be slow to respond.

Fernando Jorge Mota fjorgemota

👨‍🎓
I may be slow to respond.
Block or report user

Report or block fjorgemota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fjorgemota
fjorgemota / convertHTMLtoJS.php
Created Sep 16, 2012
Convert HTML to Javascript using DOM in PHP
View convertHTMLtoJS.php
<?php
function convertHTMLtoJS($html){
if(is_string($html)){
$type = "string";
}
else{
$type = get_class($html);
}
switch($type){
case "DOMDocument":
@fjorgemota
fjorgemota / PrivateAttributes.py
Last active Dec 11, 2015
Simple example of a pratical method to create private attributes in Python using functions closures
View PrivateAttributes.py
class People:
'''Just a class to save the name of a people'''
def __init__(self, name):
'''Just saves the name of a people'''
obj = {} #A internal variable to save the state of the attribute
def setName(new_name):
'''Just a function to set the name of a people'''
obj["name"] = new_name #It's available in the internal variable representation
self.setName = setName #Just point it to the object
def getName():
View gist:5223013
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAkABzADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDh/svt+n/2NH2X2/T/AOxrd+zn0H5D/Gj7OfQfkP8AGv8AFc/DzC+y+36f/Y0fZfb9P/sa3fs59B+Q/wAaPs59B+Q/xoAwvsvt+n/2NH2X2/T/AOxrd+zn0H5D/Gj7OfQfkP8AGgDC+y+36f8A2NH2X2/T/wCxrd+zn0H5D/Gj7
@fjorgemota
fjorgemota / hello.cpp
Last active Aug 29, 2015
Mini-Servidor em C++
View hello.cpp
#include <cstdlib>
#include <iostream>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
using namespace std;
int main(int argc, char **argv) {
@fjorgemota
fjorgemota / removedor-acentos.cpp
Created Nov 27, 2014
Removedor simples de acento em C
View removedor-acentos.cpp
#include <stdio.h>
#include <stdlib.h>
char* removeAcento(char *string){
int i=0;
int resultado = 0;
while(string[i] != '\0'){
if(!((string[i] < 97 || string[i] > 122) && (string[i] < 65 || string[i] > 90))) {
resultado++;
}
You can’t perform that action at this time.