Skip to content

Instantly share code, notes, and snippets.

View wallacemaxters's full-sized avatar

Wallace Maxters wallacemaxters

View GitHub Profile
@wallacemaxters
wallacemaxters / jotEvent.js
Last active May 9, 2018 16:59
Sugestão de manipulação de events para a biblioteca https://github.com/brcontainer/jot.js
(function (window) {
"use strict";
var forEach = Array.prototype.forEach;
var Event = function (nodeList) {
this.nodeList = nodeList;
};
var proto = Event.prototype;
@wallacemaxters
wallacemaxters / url_parser.js
Last active December 2, 2017 12:40
idea for javascript url parser
function url_parse (href, name) {
var a = document.createElement('a');
a.href = href;
if (name) return a[name];
return {
host: a.hostname,
@wallacemaxters
wallacemaxters / index.php
Created June 8, 2017 17:32
Ótima forma de se trabalhar com filas/semáforos em PHP
<?php
// Exemplo de Message Queue nativo em PHP
// Veja a documentação sobre "Funções Semáforo" : http://php.net/manual/pt_BR/ref.sem.php
define('__ID__', 59544);
// Definimos um ID para a Fila
@wallacemaxters
wallacemaxters / wget.py
Created May 30, 2017 17:35
Pequeno programa escrito em Python pra fazer download via linha de comando.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
def open_url(url):
return urllib2.urlopen(url).read()
if __name__ == '__main__':
@wallacemaxters
wallacemaxters / example.html
Last active April 25, 2017 20:13
Simple countdown written for angularJS
<!DOCTYPE html>
<html>
<head>
<title>Countdown Test</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="wm-countdown.js"></script>
@wallacemaxters
wallacemaxters / middle.js
Created April 12, 2017 18:46
Gets the number in the middle
function middle() {
var numbers = Array.prototype.slice.call(arguments);
if (numbers.length % 2 == 0) throw Error("The number of parameters should be odd");
var min, max;
while (numbers.length > 1) {
@wallacemaxters
wallacemaxters / favicon.sublime-snippet
Created January 27, 2017 16:04
Sublime snippet to favicon tag creation
<snippet>
<content><![CDATA[
<link rel="icon" type="image/png" href="$1">
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>favicon</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html</scope>
</snippet>
@wallacemaxters
wallacemaxters / quiet_debug.php
Created January 19, 2017 11:10
Quiet debug for expression/variable on shutdown (html commented)
<?php
/**
* Debug a expression/variable on shutdown with html comment
*
* @param ...$args
* @return void
* */
function quiet_debug()
{
@wallacemaxters
wallacemaxters / Routing.py
Created November 4, 2016 17:43
provides a classes for easy routing with python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
class NotMatchingException(Exception):
pass
"""
This class represente a route
"""
@wallacemaxters
wallacemaxters / ui-bootstrap-dialogs.js
Created October 14, 2016 12:16
confirm and alert dialog using uib-modal of the ui angular bootstrap
angular.module('ui.bootstrap.dialogs', ['ui.bootstrap'])
.factory('$dialogConfirm', function ($uibModal) {
return function (message, title) {
var modal = $uibModal.open({
size: 'sm',
template: '<div class="modal-header">\
<h4 class="modal-title" ng-bind="title"></h4>\