Skip to content

Instantly share code, notes, and snippets.

View josenaves's full-sized avatar
🏠
Working from home

José Naves Moura Neto josenaves

🏠
Working from home
View GitHub Profile
@josenaves
josenaves / eclipse.desktop
Created March 10, 2014 17:52
Launcher file for Ubuntu derivatives
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=eclipse
Terminal=false
Icon=eclipse
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
@josenaves
josenaves / ngRoute
Created March 30, 2014 00:02
Adding ngRoute as a dependency for a module
var serviceApp = angular.module('ep10App', ['ngRoute']);
@josenaves
josenaves / Routes
Created March 30, 2014 00:04
Route - $routeProvider configuration
serviceApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/states', { templateUrl: 'list.html', controller: 'controllerEp10'}).
when('/create', { templateUrl: 'create.html', controller: 'controllerEp10'}).
when('/delete', { templateUrl: 'list.html', controller: 'controllerEp10'}).
otherwise({
redirectTo: '/states'
});
}
@josenaves
josenaves / git-branch-in-terminal
Created September 10, 2014 19:07
Git branch on bash prompt
# prompt
force_color_prompt=yes
# Add git branch if its present to PS1
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
import urlparse
import oauth2 as oauth
consumer_key = ''
consumer_secret = ''
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
/*
Instructions:
1. Log in with your account and go to the desired course
2. Open the courseware tab
3. Configure the week variable
4. Copy this code and paste it in the browser console
*/
@josenaves
josenaves / gist:6040590
Created July 19, 2013 16:42
Insert ... select in mongodb
use admin_loja;
db.planos.find().forEach( function(plano) {
if (typeof(plano.deals) != 'undefined') {
for (i = 0; i < plano.deals.length; i++) {
produtos = plano.deals[i].produtos;
@josenaves
josenaves / jekyll-installation
Last active December 24, 2015 22:28
Jekyll Installation
jnaves@skynet:~$ rvm install 1.9.2
Searching for binary rubies, this might take some time.
No binary rubies available for: debian/wheezy_sid/x86_64/ruby-1.9.2-p320. Continuing with compilation. Please read ‘rvm help mount’ to get more information on binary rubies.
Checking requirements for debian. Installing requirements for debian.
Hit http://br.archive.ubuntu.com precise Release.gpg
Hit http://br.archive.ubuntu.com precise-updates Release.gpg
Hit http://br.archive.ubuntu.com precise-backports Release.gpg
jnaves@skynet:~/Apps$ git clone https://github.com/thomasf/exitwp
Cloning into 'exitwp'...
remote: Counting objects: 253, done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 253 (delta 134), reused 225 (delta 110)
Receiving objects: 100% (253/253), 45.39 KiB, done.
Resolving deltas: 100% (134/134), done.
jnaves@skynet:~/Apps/exitwp$ sudo pip install --upgrade -r pip_requirements.txt
jnaves@skynet:~/Apps/exitwp$ python exitwp.py
reading: wordpress-xml/worpress.xml
Traceback (most recent call last):
File "exitwp.py", line 361, in <module>
data = parse_wp_xml(wpe)
File "exitwp.py", line 82, in parse_wp_xml
root = tree.parse(file, parser)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1643, in feed