This file contains 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 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"); |
This file contains 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
1) In your terminal, open the file using vim: | |
vim file_name | |
2) Remove all BOM characters: | |
:set nobomb | |
3) Save the file: | |
:wq |
This file contains 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
# 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/ |
This file contains 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 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 |
This file contains 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 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''' |
This file contains 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
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': |
This file contains 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
{ | |
"firstName": "Reginald", | |
"lastName": "Fake", | |
"gender": "Male", | |
"dob":"1983-01-01", | |
"email":"[email protected]", | |
"address": { | |
"streetAddress": "21 Fake Street", | |
"city": "New York City", | |
"state": "NY", |
This file contains 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 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+)?$' |
This file contains 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
/* 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); | |
} | |
} |
This file contains 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
# 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') |
NewerOlder