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
(function() {
var script,
scripts = document.getElementsByTagName('script')[0];
function load(url) {
script = document.createElement('script');
script.async = true;
script.src = url;
scripts.parentNode.insertBefore(script, scripts);
@jCrip
jCrip / CSSComb Default.json
Last active December 15, 2015 06:19
CSSComb Default
{
"custom_sort_order": false,
"sort_order": [
"position",
"top",
"right",
"bottom",
"left",
"z-index",
"display",
@jCrip
jCrip / SublimeText_User_Settings.json
Last active December 19, 2015 17:09
My Sublime Text 2 personal settings
{
"auto_complete_commit_on_tab": true,
"auto_complete_triggers":
[
{
"characters": "<",
"selector": "text.html"
},
{
"characters": "/",
@jCrip
jCrip / notepad.html
Last active December 19, 2015 18:09 — forked from jdkanani/notepad.html
Browser Editor
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/tomorrow_night_eighties");e.getSession().setMode("ace/mode/html");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
$ = jQuery
TIMEOUT = 20000
lastTime = (new Date()).getTime()
setInterval ->
currentTime = (new Date()).getTime()
# If timeout was paused (ignoring small
# variations) then trigger the 'wake' event
if currentTime > (lastTime + TIMEOUT + 2000)
@jCrip
jCrip / array_mode.rb
Last active December 21, 2015 10:09 — forked from parksilk/array_mode.rb
def mode(array)
counter = Hash.new(0)
# this creates a new, empty hash with no keys, but makes all default values zero. it will be used to store
# the information from the array, such that the keys will be each unique number from the array (IOW, if there
# are two or more 4's in the array, there will just be one key that is a 4), and the value for each key will
# be the number of times that integer appears in the array.
array.each do |i|
counter[i] += 1
end
# this interates throught the array, and for each element it creates a key for that integer (if it hasn't been
@jCrip
jCrip / rpn.md
Created August 23, 2013 03:41 — forked from malandrina/gist:3744867
Implementing a Reverse Polish notation calculator in Ruby

Implementing a Reverse Polish notation calculator in Ruby

A couple weeks ago I had a go at implementing an RPN calculator in Ruby. I knew I wanted the calculator to function by popping operands out of an array populated with the values of the input expression, operating upon the operands with the appropriate operator, and pushing the result back into the stack of operands.

I was able to implement this in version 1, but it took forever and the resulting code was not very beautiful. Why?

  • I started coding before I had a thorough understanding of RPN

    Wait, 20 10 5 4 + * - is what now?

@jCrip
jCrip / jquery.exists.js
Created September 3, 2013 22:49
Check if Element Exists
// Tiny jQuery Plugin
// by Chris Goodchild
$.fn.exists = function(callback) {
var args = [].slice.call(arguments, 1);
if (this.length) {
callback.call(this, args);
}
return this;
@jCrip
jCrip / oddeven.rb
Created September 5, 2013 03:06
Get Odd or Even entries of an array
class Array
def odd_values
self.values_at(* self.each_index.select {|i| i.odd?})
end
def even_values
self.values_at(* self.each_index.select {|i| i.even?})
end
end
@jCrip
jCrip / formbutton.js
Created November 11, 2013 00:51
Disabling submit button until all fields have values
function buttonState(){
$("input").each(function(){
$('#register').attr('disabled', 'disabled');
if($(this).val() == "" ) return false;
$('#register').attr('disabled', '');
})
}
$(function(){
$('#register').attr('disabled', 'disabled');