Skip to content

Instantly share code, notes, and snippets.

View goinnn's full-sized avatar
🏠
Working remotely

Pablo Martín goinnn

🏠
Working remotely
View GitHub Profile
@ianlintner-wf
ianlintner-wf / cordova-google-services-version-gradle-fix.js
Last active February 19, 2019 10:10
This is to fix version issues between multiple google services plugins in Ionic & cordova builds. Cordova before_prepare hook.
#!/usr/bin/env node
// Define hook in your config <hook src="scripts/cordova-google-services-version-gradle-fix.js" type="before_prepare" />
var sourceDir = '';
var platformDir = 'platforms/android';
var fs = require('fs');
var path = require('path');
var readline = require("readline");
@szydan
szydan / gist:b225749445b3602083ed
Last active June 19, 2024 13:13
<U+FEFF> character showing up in files. How to remove them?
1) In your terminal, open the file using vim:
vim file_name
2) Remove all BOM characters:
:set nobomb
3) Save the file:
:wq
@rozifus
rozifus / Python SimpleHTTPServer with SSL
Last active October 9, 2022 22:40
Python SimpleHTTPServer with SSL
# useful for running ssl server on localhost
# which in turn is useful for working with WebSocket Secure (wss)
# copied from http://www.piware.de/2011/01/creating-an-https-server-in-python/
@rubanm
rubanm / paramiko-sftp.py
Created June 19, 2013 21:27
Paramiko SFTP username/password authentication via SOCKS proxy
import paramiko
import socket
import socks
# set up SOCKS proxy
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, proxy_details['host'],
proxy_details['port'], True, proxy_details['username'],
proxy_details['password'])
socket.socket = socks.socksocket
@goinnn
goinnn / gist:5530987
Last active December 17, 2015 01:49 — forked from armonge/gist:2830057
import urlparse
import re
from django import forms
from django.db import models
from django.utils.translation import ugettext_lazy as _
def validate_youtube_url(value):
'''El patron lo saque de http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex'''
@goinnn
goinnn / form_process.py
Created October 26, 2012 11:10
Example the edit and add views to the form process
def content_add(request, template_name='content/content_add.html', extra_context=None):
extra_context = extra_context or {}
extra_context['submit'] = 'Add'
return content_edit(request, template_name=template_name, extra_context=extra_context)
def content_edit(request, content_id=None, template_name='content/content_edit.html', extra_context=None):
data = instance = None
extra_context = extra_context or {}
if request.method == 'POST':
@mcrider
mcrider / cvson.json
Created October 20, 2012 22:51
Example CV JSON
{
"firstName": "Reginald",
"lastName": "Fake",
"gender": "Male",
"dob":"1983-01-01",
"email":"[email protected]",
"address": {
"streetAddress": "21 Fake Street",
"city": "New York City",
"state": "NY",
@armonge
armonge / gist:2830057
Created May 29, 2012 19:04
django youtube field
import urlparse
import re
from django.db import models
from django import forms
def validate_youtube_url(value):
'''El patron lo saque de http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex'''
pattern = r'^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?:\S+)?$'
@visnup
visnup / lock.css
Created May 5, 2012 20:31
"lock" orientation of a website for mobile (iPad, iPhone)
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */
@media (orientation: portrait) {
body {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}
@vgoklani
vgoklani / mongodb_drop.py
Created January 3, 2012 18:40
drop a database or collection via pymongo
# dropping a database via pymongo
from pymongo import Connection
c = Connection()
c.drop_database('mydatabase')
# drop a collection via pymongo
from pymongo import Connection
c = Connection()
c['mydatabase'].drop_collection('mycollection')