Skip to content

Instantly share code, notes, and snippets.

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

Carlos Montalvo ZephiroRB

🏠
Working from home
View GitHub Profile
List<String> animals = new ArrayList<>();
// Adding new elements to the ArrayList
animals.add("Lion");
animals.add("Tiger");
animals.add("Cat");
animals.add("Dog");
animals.add("Cuy");
@ZephiroRB
ZephiroRB / package.json
Last active March 27, 2019 22:42
Add support multiple extension for jQuery Code Snippets VS Code
{
"name": "jquerysnippets",
"displayName": "jQuery Code Snippets",
"description": "Over 130 jQuery Code Snippets",
"version": "0.0.1",
"publisher": "donjayamanne",
"license": "SEE LICENSE IN LICENSE or README.MD",
"homepage": "https://github.com/DonJayamanne/jquerysnippets/blob/master/README.md",
"icon": "images/icon.png",
"engines": {
@ZephiroRB
ZephiroRB / credits.js
Created November 8, 2018 18:12
Credits by console javascript
class User {
constructor(firstName, lastName, email) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
}
print() {
console.group("Developer");
console.warn("firstName: ", this.firstName);
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<VideoView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/video1"/>
</RelativeLayout>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.tocame.carlosmontalvo.tocame.MainActivity">
<com.tocame.carlosmontalvo.tocame.MultiTouch
android:layout_width="match_parent"
android:layout_height="match_parent"
@ZephiroRB
ZephiroRB / test.rb
Created September 18, 2018 17:22
Encuestra los numeros
#!/usr/bin/ruby
arreglo = [3,4,9,20, 8, 1, 7, 12, 15, 11, 5, 9, 6, 16, 10, 2]
def encontrar_numeros(numero, arreglo)
partes = arreglo.each_slice(4).to_a
encontrados = []
@ZephiroRB
ZephiroRB / tokenable.rb
Created August 12, 2018 21:47
Concerns Tokenable Models
module Tokenable
extend ActiveSupport::Concern
included do
before_create :generate_token
scope :search_token, ->(token) { find_by(token: token, disable: false ) }
def to_param
token
@ZephiroRB
ZephiroRB / fix_duplicate_key.rb
Last active August 5, 2018 00:05
Rails (PG::Error: ERROR: duplicate key value violates unique constraint "table_pkey" DETAIL: Key (id)=(1) already exists.
#I found the reset_pk_sequence! from this thread. http://www.ruby-forum.com/topic/64428
#rails console
ActiveRecord::Base.connection.tables.each do |t|
ActiveRecord::Base.connection.reset_pk_sequence!(t)
end
#or ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.reset_pk_sequence!(t) }
@ZephiroRB
ZephiroRB / manipulate_json.rb
Created February 19, 2018 16:44
Manipulate file json with Rails
def get_user_json(utoken)
File.read("#{path_user_json}/#{utoken}.json")
end
def delete_user_json(utoken)
FileUtils.rm("#{path_user_json}/#{utoken}.json")
end
def empty_user_json(utoken)
begin
@ZephiroRB
ZephiroRB / application.scss
Created February 18, 2018 04:53 — forked from goozler/application.scss
Rails 4 fonts (webfonts.ru roboto example)
//= require fonts