This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Reconstói todo o conteúdo HTML sob $node; | |
* em resumo, isso funciona como innerHTML do Javascript | |
* | |
* @param DOMNode $node | |
* @return string Conteúdo HTML reconstruído | |
*/ | |
function dom_reconstruct(DOMElement $node){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding: utf-8 | |
import sys | |
import subprocess | |
mute_command = 'amixer sset Master mute' | |
unmute_command = 'amixer sset Master unmute' | |
def sys_message(msg): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
"""Pesquisador de padrões de strings em arquivos de texto. | |
A busca nos diretórios recursivamente é suportada. | |
""" | |
import sys | |
import os | |
import re | |
import argparse | |
import mimetypes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#coding: utf-8 | |
"""Captura os links de download direto do portal hyuugadownloads.com.br. | |
$ hyuuga.py --help | |
""" | |
import sys | |
import os | |
import tempfile | |
import argparse | |
import urllib2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('simple_html_dom.php'); | |
$html = file_get_html('http://172.16.1.15/web/guest/en/websys/status/getUnificationCounter.cgi'); | |
$found = $html->find(".staticProp", 1); # retorna um objeto não iterável ou NULL | |
if (!$found) { | |
exit("Nenhum elemento encontrado!"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use src/Mailer/MailerInterface | |
class MailerService | |
{ | |
public function sendMail(MailerInterface $mailer) | |
{ | |
//... | |
} | |
} | |
# use Illuminate\Contracts\Mailer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Faça um programa em Linguagem C que leia uma matriz de | |
ordem 100 (ou seja 100x100) composta por números inteiros positivos | |
e escreva qual o maior número de fibonacci da coluna coluna, onde coluna é o | |
numero inteiro informado pelo usuário. | |
*/ | |
#include <stdio.h> | |
int isFibonacci(n) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# StackOverflow related question: http://stackoverflow.com/questions/34886008/create-nested-array-by-array-of-key | |
# The @Gavriel's answer is pretty good! | |
# But it could be somewhat more "*easy to catch*" like this: | |
$new = $value; | |
foreach (array_reverse($keys) as $valueAsKey) $new = [$valueAsKey => $new]; | |
# In fact, it's a version of @Gavbriel's answer using array_reverse() and some semantic variables. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import os.path as path | |
htmlroot = '/home/martins/Desktop/htmltest' | |
asset_replacements = { | |
'http://symfony.com/js/v5/all.js': '{}_static/all.js', | |
'http://symfony.com/css/compiled/v5/all.css': '{}_static/all.css' | |
} | |
def calculate_relative_path_to_root(path, start='html'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var searcher = new Bloodhound({ | |
datumTokenizer: Bloodhound.tokenizers.obj.whitespace(), | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
remote: { | |
url: 'http://host.com/busca?q=%QUERY', | |
wildcard: '%QUERY' | |
} | |
}); | |
var typeahead = $('input.typeahead').typeahead({ |
OlderNewer