This file contains hidden or 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
/** | |
* Creates promise object for DWR async calls. | |
* @param dwrFunc DWR function to be invoked | |
* @param arrayOfParameters [optional] parameters of given DWR function | |
* @returns {Q.promise} | |
*/ | |
function qDwr(dwrFunc, arrayOfParameters) { | |
var deferred = Q.defer(); | |
if (arrayOfParameters === undefined || arrayOfParameters === null) { | |
arrayOfParameters = []; |
Antes de empezar a soltar comandos como un bellaco, hay que explicar los conceptos clave que se necesitan conocer para trabajar con Git.
Comenzaremos con los diferentes estadios en los que puede encontrarse nuestro código (nuestros cambios sobre el contenido de los ficheros, en realidad).
- Workspace: Es el estado real de nuestros ficheros. Tal y como los vemos en nuestro editor.
- Stage: Aquí se encuentran los cambios sobre nuestros ficheros que se incluirán en el próximo commit. Cuando hacemos un
git add
, ungit rm
o ungit mv
, estamos introduciendo cambios en el stage, indicándole a Git que en el próximo commit esos cambios irán incluidos.
This file contains hidden or 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
angular.module('test') | |
.controller('HomeCtrl', function ($scope, $http, Socket) { | |
var vm = this; | |
vm.items = []; | |
vm.lastMsg = ''; | |
$http.get('/api/items').success(function (res) { | |
vm.items = res; |
This file contains hidden or 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 java.io.FileDescriptor; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.io.PrintStream; | |
public class HelloWorld{ | |
private static HelloWorld instance; | |
public static void main(String[] args){ | |
instantiateHelloWorldMainClassAndRun(); |
This file contains hidden or 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
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 |
This file contains hidden or 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
Enhanced NGINX logstash parser: | |
NGINX log format: | |
log_format enhanced '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_length "$http_referer" "$http_user_agent" $request_time $upstream_response_time'; | |
access_log /var/log/nginx/access.log enhanced; | |
error_log /var/log/nginx/error.log; | |
logstash pattern (/opt/logstash/pattern/nginx): |
This file contains hidden or 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
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here: http://lduros.net/posts/tracker-sucks-thanks-tracker/
After discovering it chowing 2 cores, I decided to go about disabling it.
Directories
This file contains hidden or 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 org.hibernate.jpa.HibernatePersistenceProvider; | |
import org.springframework.context.annotation.Configuration; | |
import javax.annotation.PostConstruct; | |
import javax.persistence.spi.PersistenceProvider; | |
import javax.persistence.spi.PersistenceProviderResolver; | |
import javax.persistence.spi.PersistenceProviderResolverHolder; | |
import java.util.Collections; | |
import java.util.List; |