To keep the changes from the commit you want to undo
$ git reset --soft HEAD^
To destroy the changes from the commit you want to undo
$ git reset --hard HEAD^
You can also say
To keep the changes from the commit you want to undo
$ git reset --soft HEAD^
To destroy the changes from the commit you want to undo
$ git reset --hard HEAD^
You can also say
| /** | |
| * Add two string time values (HH:mm:ss) with javascript | |
| * | |
| * Usage: | |
| * > addTimes('04:20:10', '21:15:10'); | |
| * > "25:35:20" | |
| * > addTimes('04:35:10', '21:35:10'); | |
| * > "26:10:20" | |
| * > addTimes('30:59', '17:10'); | |
| * > "48:09:00" |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main| If you are using Spring Boot with MongoDB, then a MongoDB connection is required even if you are unit testing a function. | |
| Spring creates a connection to mongoDB during start up, because of Autowired beans in your code. This slows down your unit tests, and | |
| also means your unit tests require access to the MongoDB server. | |
| Here is what you need to do: | |
| 1. Mock the beans created by org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration: | |
| @Bean | |
| public MongoDbFactory mongoDbFactory(){ | |
| return null; | |
| } |
| // imports a couple of java tasks | |
| apply plugin: "java" | |
| // List available tasks in the shell | |
| > gradle tasks | |
| // A Closure that configures the sourceSets Task | |
| // Sets the main folder as Source folder (where the compiler is looking up the .java files) | |
| sourceSets { | |
| main.java.srcDir "src/main" |
This Makefile aids in developing a ruby gem. It's pretty opinionated to my workflow, but it might be useful to you, so here it goes.
gs][gs] (or [gst][gst]) for managing gemsets.dep][dep] for installing dependencies. Because fuck
Bundler.basename $(dirname $(pwd)) would return foo| #!/bin/sh | |
| # | |
| # git-stash-push | |
| # Push working tree onto the stash without modifying working tree. | |
| # First argument (optional) is the stash message. | |
| if [ -n "$1" ]; then | |
| git update-ref -m "$1" refs/stash "$(git stash create \"$1\")" | |
| else | |
| HASH=`git stash create` | |
| MESSAGE=`git log --no-walk --pretty="tformat:%-s" "$HASH"` |
| # the following command will convert all the files to HTML which has the DOC extension. | |
| find . -name "*.DOC" -type f -print0 |xargs -0 -I {} libreoffice --headless --convert-to html:HTML --outdir /home/nasir/output {} |
| # There are 3 levels of git config; project, global and system. | |
| # project: Project configs are only available for the current project and stored in .git/config in the project's directory. | |
| # global: Global configs are available for all projects for the current user and stored in ~/.gitconfig. | |
| # system: System configs are available for all the users/projects and stored in /etc/gitconfig. | |
| # Create a project specific config, you have to execute this under the project's directory. | |
| $ git config user.name "John Doe" | |
| # Create a global config |
| # Router / Central hub for home automation. | |
| # Receives events and distributes via pub/sub | |
| zmq = require 'zmq' | |
| inputPort = 'tcp://*:8888' | |
| outputPort = 'tcp://*:9999' | |
| # Pull socket for incoming (push/pull), pub for outgoing (pub/sub) | |
| input = zmq.socket 'pull' |