Skip to content

Instantly share code, notes, and snippets.

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

Juan Cristobal Pazos jCrip

🏠
Working from home
  • Modyo
  • Santiago, Chile
View GitHub Profile
@jCrip
jCrip / Advanced Classes
Created September 28, 2015 20:27 — forked from JoseJRVazquez/Advanced Classes
My Lesson in Advanced Classes in Ruby
Ok, so Inheritance
its not just for young white dudes waiting for their grandparents to fucking keel over at 82.
In ruby, Inheritance allows one class to inherit from another class attributes and behaviors (methods) that it didnt have before. The inheriter, much like a young white male, is the child class. The class that it inherits from, rather than being his old money grandparents, is the Parent Class. The lesson says Inheritance is designated with a < symbol, for example:
class Daughter < Father
end
wow, quick right. So for that, the daughter is getting methods from the father. Simple right. But lets go deeper and se how fucked up this can really get for those of us in the cheap seats.
@jCrip
jCrip / filterable.rb
Created May 12, 2016 18:52 — forked from justinweiss/filterable.rb
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with the same name as the keys in <tt>filtering_params</tt>
# with their associated values. Most useful for calling named scopes from
@jCrip
jCrip / subpackageslist.txt
Created May 21, 2016 00:53
My starter packages for sublime.
"Advanced CSV",
"AdvancedNewFile",
"AlignTab",
"All Autocomplete",
"ApplySyntax",
"AutoFileName",
"Autoprefixer",
"BeautifyRuby",
"Better CoffeeScript",
"BracketHighlighter",
@jCrip
jCrip / .powrc
Created August 5, 2016 20:14
Pow RVM Integration
# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi
# load environment of current project ruby
if
@jCrip
jCrip / app.styl
Created October 27, 2016 18:23 — forked from douglascorrea/app.styl
Angular Directive for Particles JS - https://github.com/VincentGarreau/particles.js
.particleJs
background-color transparent
width 35%
height 100%
display block
position absolute
top 0px
left 0px
@jCrip
jCrip / HTML5 Form Validation Fallback.markdown
Last active February 6, 2017 19:44 — forked from ashblue/A-Pen-by-Ash-Blue.markdown
HTML5 Form Validation Fallback (without a library)
@jCrip
jCrip / commit-msg
Created April 12, 2017 16:33 — forked from wesbos/commit-msg
ESLint 3.0 Git Pre Commit Hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.jsx\?$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
failed=0
for file in ${files}; do
@jCrip
jCrip / .eslintrc.json
Last active August 6, 2017 18:42
ESLint configuration
{
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"extends": [
"airbnb",
"plugin:vue/recommended",
],
@jCrip
jCrip / array_dupplicate_counter.js
Created August 18, 2017 19:17 — forked from ralphcrisostomo/array_dupplicate_counter.js
Javascript: Count duplicates in an array
/**
Problem:
You have a javascript array that likely has some duplicate values and you would like a count of those values.
Solution:
Try this schnippet out.
*/
@jCrip
jCrip / xmlToJson.js
Created April 17, 2018 19:26 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
function xmlToJson(xml) {
// Create the return object
var obj = {};
if (xml.nodeType == 1) { // element
// do attributes
if (xml.attributes.length > 0) {