Skip to content

Instantly share code, notes, and snippets.

View fernandovega's full-sized avatar

Fernando Vega fernandovega

View GitHub Profile
@fernandovega
fernandovega / 0_reuse_code.js
Created February 25, 2014 15:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
$Date = "2010-09-17";
echo date('Y-m-d', strtotime($Date. ' + 1 days'));
echo date('Y-m-d', strtotime($Date. ' + 2 days'));
?>
backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql
import ConfigParser, mmap
config_file = "/usr/share/applications/google-chrome.desktop"
add_string_to_each_section = ["StartupWMClass", "Google-chrome-stable"]
option = add_string_to_each_section[0]
value = add_string_to_each_section[1]
class Fixer:
def check(self, cf, option, value):
###
### ejabberd configuration file
###
###
### The parameters used in this configuration file are explained in more detail
### in the ejabberd Installation and Operation Guide.
### Please consult the Guide in case of doubts, it is included with
### your copy of ejabberd, and is also available online at
### http://www.process-one.net/en/ejabberd/docs/

Youtube/Vimeo Video Url Parser

Parses URLs from major cloud video providers. Capable of extracting keys from various video embed and link urls to manipulate and access videos in various ways.

Usage

VideoUrlParser::identify_service("https://www.youtube.com/watch?v=x_8kFbZf20I&amp;feature=youtu.be");
@fernandovega
fernandovega / hack.sh
Last active August 29, 2015 14:24 — forked from erikh/hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@fernandovega
fernandovega / .sql
Created November 26, 2016 14:32
Truncate all tables in db
SET FOREIGN_KEY_CHECKS=0;
SELECT Concat('TRUNCATE TABLE ',table_schema,'.',TABLE_NAME, ';') FROM INFORMATION_SCHEMA.TABLES where table_schema in ('sectorvisual');
function mg_send($to, $subject, $message) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'api:'.MAILGUN_API);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$plain = strip_tags(br2nl($message));
curl -sL https://deb.nodesource.com/setup_5.x -o nodesource_setup.sh
sudo -E bash ./nodesource_setup.sh
sudo apt-get install -y nodejs build-essential git
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
git clone https://github.com/ParsePlatform/parse-server-example.git