Skip to content

Instantly share code, notes, and snippets.

Avatar

Eduardo Luiz eduardoluizgs

View GitHub Profile
View gist:0a22ec55e06d1a88dd18a88896b0ba51
function post_to_url(path, params, method) {
method = method || "post";
var form = document.createElement("form");
//Move the submit function to another variable
//so that it doesn't get overwritten.
form._submit_function_ = form.submit;
form.setAttribute("method", method);
@eduardoluizgs
eduardoluizgs / gist:ca8a8b19f4b981d6f750302f7ef569d7
Created Mar 11, 2017
Angular 2 - Start new project with angular-cli
View gist:ca8a8b19f4b981d6f750302f7ef569d7
# install angular cli
sudo npm install -g angular cli
# init new application
ng new app_name --routing
cd app_name
ng init app_name
# serve your application
ng serve
@eduardoluizgs
eduardoluizgs / use_pfx_with_requests.py
Created Dec 27, 2017 — forked from erikbern/use_pfx_with_requests.py
How to use a .pfx file with Python requests – also works with .p12 files
View use_pfx_with_requests.py
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''
@eduardoluizgs
eduardoluizgs / mutable_namedtuple_comparison.py
Created Sep 11, 2018 — forked from grantjenks/mutable_namedtuple_comparison.py
Performance Comparison of namedtuple, namedlist, and recordclass
View mutable_namedtuple_comparison.py
import sys
class Record(object):
__slots__ = ()
def __init__(self, *args):
assert len(self.__slots__) == len(args)
for field, value in zip(self.__slots__, args):
setattr(self, field, value)