Skip to content

Instantly share code, notes, and snippets.

View aj07mm's full-sized avatar

Julio Marins aj07mm

View GitHub Profile
@aj07mm
aj07mm / readme.md
Last active August 29, 2015 14:23 — forked from felippenardi/readme.md

Benchmarking AngularJS performance

Things to optmize

  • Use one-time-bind on expressions ( {{::value}} )
  • Replace $scope.$apply() with $scope.$digest() whenever possible
  • Move filters to controllers

Measuring Watch list

To get the total watchers on the current page, you can run this script on the browser console:

@aj07mm
aj07mm / flask-upload
Last active August 29, 2015 14:23 — forked from dAnjou/flask-upload
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess www user=max group=max threads=5
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi
<Directory /home/max/Projekte/flask-upload>
WSGIProcessGroup www
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
@aj07mm
aj07mm / js
Created November 9, 2015 16:21
closure mongoose
CalcTrack = function(){
this.isInsideTheCircunference = function(track, stop, radius){
var trackC1 = track.posicao[0];
var trackC2 = track.posicao[1];
var stopC1 = stop.posicao[0];
var stopC2 = stop.posicao[1];
if(Math.sqrt(Math.pow(trackC1-trackC2,2) + Math.pow(stopC1-stopC2,2)) <= radius){
return true;
@aj07mm
aj07mm / gist:ced48a900cbb91745168
Last active November 17, 2015 15:20
closure forinforin
//agora vai
for(id_pontoreferencia in obj_diff){
for(id_linha in obj_diff[id_pontoreferencia]){
diff = this.getDiff(obj_diff[id_pontoreferencia][id_linha]);
this.update(id_pontoreferencia, id_linha, diff.max()/60);
//zera diff de cada linha do ponto
diff = [];
}
}
@aj07mm
aj07mm / gist:c9f77084c8645dce1ca0
Created December 1, 2015 16:47
recursive crawling
import re
import mechanize
#from bs4 import BeautifulSoup
class Crawler:
def __init__(self):
self.url_list = []
self.loop = 0
def get_url_regex(self, url):
<?php
trait MetaClass
{
protected $__classMethods = array();
static protected $__staticMethods = array();
public function __call($name, $args)
{
@aj07mm
aj07mm / python
Created January 11, 2016 15:10
codility-demo.py
def equilibrium(A):
P_arr = []
ini_range = 1
end_limit = len(A) - 2
for x in xrange(ini_range, end_limit):
sum_prev = sum(xrange(ini_range,x-1))
sum_pos = sum(xrange(x+1,end_limit))
if(sum_prev == sum_pos):
P_arr.append(x)
return P_arr
@aj07mm
aj07mm / .js
Created January 15, 2016 18:28
GET request call http/https nodejs
var https = require('https'),
http = require('http'),
optionsget = {
host : 'maps.googleapis.com', // here only the domain name
path : '/maps/api/directions/json?origin=Toledo&destination=Madrid&region=es&key=key', // the rest of the url with parameters if needed
method : 'GET', // do GET
json:true
};
// do the GET request
@aj07mm
aj07mm / .js
Created January 16, 2016 03:14
GET nodejs with request
var request = require('request');
// Set the headers
var headers = {
'User-Agent': 'Super Agent/0.0.1',
'Content-Type': 'application/x-www-form-urlencoded'
}
// Configure the request
var options = {
@aj07mm
aj07mm / isSumPossibleZ.js
Last active January 21, 2016 02:02
isSumPossibleZ
//retunr 1 , if there exits a certain group of Z numbers selected from the array
//such that their sum equals N
//HackerRank passing 13/14
exports.isSumPossibleZ = function(A, n, Z) {
var sum = function(A, pastSums, Z){
//each execution run 2 by default, so Z is Z-2
Z = Z-2;
if(Z <= 0){
Z = 0;
}