Skip to content

Instantly share code, notes, and snippets.

View folksilva's full-sized avatar

Luiz Fernando da Silva folksilva

View GitHub Profile
@folksilva
folksilva / jquerybrowsercss.html
Created June 1, 2012 18:27
JQuery Browser Specific CSS Example
<html>
<head>
<!-- Title, meta, jquery 1.4+ etc... -->
<script>
var browser = $.browser;
if(browser == "webkit"){
$("head").append('<link rel="stylesheet" href="safari_or_chrome.css" type="text/css" >');
}else if(browser == "msie"){
$("head").append('<link rel="stylesheet" href="internet_explorer.css" type="text/css" >');
}else if(browser == "mozilla"){
@folksilva
folksilva / banners.json
Created July 4, 2012 18:30
JQuery Banner example
[{
"nome": "banner01",
"titulo": "Banner #01"
},
"nome": "banner02",
"titulo": "Banner #02"
},
"nome": "banner03",
"titulo": "Banner #03"
},
@folksilva
folksilva / gist:3938858
Created October 23, 2012 13:51
Efeito css botão rolante
/**
* Supondo que a imagem de fundo do botão tenha os 3 estados, cada um com 30px de altura e 150px de largura,
* totalizando uma imagem de 150x90px.
*/
/* Estado inicial */
div#meuBotao {
width: 150px;
height: 30px;
cursor: pointer;
@folksilva
folksilva / gist:5397672
Created April 16, 2013 17:11
Função recursiva que retorna letras em sequência. Ex.: A, B, C ... AA, AB, AC ... AAA, AAB, AAC ...
/**
* getLetra - Função que retorna as letras em sequência
* @author Luiz Fernando da Silva <[email protected]>
*
* Este trabalho está licenciado sob uma Licença Creative Commons Atribuição-CompartilhaIgual 3.0 Não Adaptada.
* Para ver uma cópia desta licença, visite http://creativecommons.org/licenses/by-sa/3.0/.
*
*/
var getLetra = function(i) {
// Define a lista de letras (A-Z)
@folksilva
folksilva / ipedreiro.c
Last active January 22, 2018 17:28
iPedreiro
#include <stdio.h>
#include <stdlib.h>
#define AREA_TIJOLO 0.08;
#define TIJOLO 0.7;
#define MAO_DE_OBRA 12.5;
int main(void) {
float tamanho_parede, qtd_tijolos, custo_tijolos, custo_mao_de_obra, total;
@folksilva
folksilva / Python_AccessMDB.py
Last active October 27, 2020 16:10
Exemplo de conexão do Python com um banco de dados MS Access via ODBC Necessário ter: - Python 2.7 - http://www.python.org/download/ - pyodbc 3 - https://code.google.com/p/pyodbc
"""
Exemplo de conexão do Python com um banco de dados MS Access via ODBC
Necessário ter:
- Python 2.7 - http://www.python.org/download/
- pyodbc 3 - https://code.google.com/p/pyodbc
Sugestão de editor: JetBrains PyCharm Community Edition (http://www.jetbrains.com/pycharm/)
"""
@folksilva
folksilva / main.py
Created November 25, 2013 21:31
Testes com PyODBC e MS Access
# -*- coding:utf-8 -*-
__author__ = 'Luiz Fernando da Silva <[email protected]>'
"""
Para consultar depois:
- Pynq: Expression Trees para Python, parecido com o Linq da Microsoft
"""
import pyodbc
@folksilva
folksilva / women_day.py
Last active March 8, 2017 13:14
Homage to the International Women's Day
#!/usr/bin/env python
def women_day():
print(" ." + (":" * 3) + "." + (" " * 3) + "." + (":" * 3) + ".")
print((":" * 7) + "." + (":" * 7))
print(":" * 15)
print("'" + (":" * 13) + "'")
print((" " * 2) + "'" + (":" * 9) + "'")
print((" " * 4) + "'" + (":" * 5) + "'")
print((" " * 6) + "':'")
@folksilva
folksilva / problem1.py
Last active February 28, 2022 13:39
Daily Coding Problem: Problem #1
"""
This problem was asked by Google.
Given a stack of N elements, interleave the first half of the stack with the second half reversed using only one other queue. This should be done in-place.
Recall that you can only push or pop from a stack, and enqueue or dequeue from a queue.
For example, if the stack is [1, 2, 3, 4, 5], it should become [1, 5, 2, 4, 3]. If the stack is [1, 2, 3, 4], it should become [1, 4, 2, 3].
Hint: Try working backwords from the end state.
@folksilva
folksilva / problem2.py
Last active July 19, 2018 16:37
Daily Coding Problem: Problem #2
"""
This problem was asked by Uber.
Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. Solve it without using division and in O(n) time.
For example, if our input was [1, 2, 3, 4, 5], the expected output would be [120, 60, 40, 30, 24]. If our input was [3, 2, 1], the expected output would be [2, 3, 6].
https://dailycodingproblem.com/
"""