Skip to content

Instantly share code, notes, and snippets.

View CristianRP's full-sized avatar
🎯
Focusing

Cristian Ramírez CristianRP

🎯
Focusing
  • Guatemala
View GitHub Profile
@CristianRP
CristianRP / CommentErb.txt
Created February 1, 2018 20:31
Add a comment into a ERB file
to comment a single line use
<%-# commented line -%>
to comment a whole block use a if false to surrond your code like this
<% if false %>
code to comment
<% end %>
@CristianRP
CristianRP / DateDeserializer.java
Last active December 29, 2017 18:16
Retrofit implementacion
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
@CristianRP
CristianRP / UserController.java
Last active December 28, 2017 05:33
Controlador
@Controller
public class UserController {
@Autowired
UserRepository mRepository;
@RequestMapping(value = "/obtenerUsuarios", method=RequestMethod.GET)
public List<Usuario> getUsuarios() {
List<Usuario> usuariosList = new ArrayList<>();
Iterable<Usuario> usuarios = mRepository.findAll();
usuarios.forEach(usuariosList::add);
@CristianRP
CristianRP / SQLConfigurationCLR2014.sql
Created November 15, 2017 18:48
SQL Server 2014 Configuration for CLR support and call web service
--CREATE DATABASE INTERFACEDB;
--GO
--USE INTERFACEDB;
--GO
--EXEC sp_configure 'show advanced options', '1';
--GO
--RECONFIGURE;
--EXEC sp_configure 'clr enabled', '1'
@CristianRP
CristianRP / SQLConfigurationCRL.sql
Created November 6, 2017 13:50
Configuration SQL Server with assemblies and support to CRL for stored procedure which consumes web services.
--EXEC sp_configure 'allow updates', 0
--go
--reconfigure
--EXEC sp_configure 'show advanced options', '1';
--reconfigure;
--EXEC sp_configure 'clr enabled', '1'
--ALTER DATABASE CUSTOMDB SET TRUSTWORTHY ON
@CristianRP
CristianRP / remove_postgres_on_mac_os.md
Created October 13, 2017 05:02 — forked from Atlas7/remove_postgres_on_mac_os.md
Note - How completely uninstall PostgreSQL 9.X on Mac OSX

This blog post has helped me clean up my postgres development environment on Mac. So making a copy!

How completely uninstall PostgreSQL 9.X on Mac OSX

This article is referenced from stackoverflow:

If installed PostgreSQL with homebrew , enter brew uninstall postgresql

If you used the EnterpriseDB installer , follow the following step.
@CristianRP
CristianRP / Commands.txt
Last active October 2, 2017 18:55
Basic commands for Docker
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker container ls # List all running containers
docker container ls -a # List all containers, even those not running
docker container stop <hash> # Gracefully stop the specified container
docker container kill <hash> # Force shutdown of the specified container
docker container rm <hash> # Remove specified container from this machine
docker container rm $(docker container ls -a -q) # Remove all containers
docker image ls -a # List all images on this machine
@CristianRP
CristianRP / android_studio_shortcuts.md
Created September 27, 2017 05:35 — forked from stkent/android_studio_shortcuts.md
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@CristianRP
CristianRP / JavaOptionalParameters.txt
Created July 24, 2017 18:09
Simulate optional parameters in Java:
https://stackoverflow.com/questions/965690/java-optional-parameters
There are several ways to simulate optional parameters in Java:
Method overloading.
void foo(String a, Integer b) {
//...
}
@CristianRP
CristianRP / VIM.txt
Created July 6, 2017 13:55
VIM hotkeys
Hit the Esc key; vim goes into command mode. Then you can type
:q to quit (short for :quit)
:q! to quit without saving (short for :quit!)
:wq to write and quit (think write and quit)
:wq! to write and quit even if file has only read permission (if file does not have write permission: force write)
:x to write and quit (similar to :wq, but won't write if there are no changes)
:qa to quit all (short for :quitall)
When you press :, a : will appear at the bottom of the screen.