Skip to content

Instantly share code, notes, and snippets.

View gaboesquivel's full-sized avatar
👾
buidl

Gabo Esquivel gaboesquivel

👾
buidl
View GitHub Profile
@gaboesquivel
gaboesquivel / gist:4434921
Created January 2, 2013 14:26
Javascript Reflector Object
// Generated by CoffeeScript 1.3.3
/**
@author Michael Czolko <michael@czolko.cz>
*/
var Reflector;
Reflector = (function() {
/**
@construct
@gaboesquivel
gaboesquivel / gist:4435001
Last active December 10, 2015 12:38
Object.getOwnPropertyNames example
var arr = ["a", "b", "c"];
print(Object.getOwnPropertyNames(arr).sort()); // prints "0,1,2,length"
// Array-like object
var obj = { 0: "a", 1: "b", 2: "c"};
print(Object.getOwnPropertyNames(obj).sort()); // prints "0,1,2"
// Printing property names and values using Array.forEach
Object.getOwnPropertyNames(obj).forEach(function(val, idx, array) {
print(val + " -> " + obj[val]);
@gaboesquivel
gaboesquivel / gist:4504605
Created January 10, 2013 18:36
Redirect Main Domain to subfolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?main\-domain.com$ [NC]
RewriteCond %{REQUEST_URI} !^/sub\-folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sub-folder/$1
RewriteCond %{HTTP_HOST} ^(www.)?main\-domain.com$ [NC]
RewriteRule ^(/)?$ sub-folder/index.php [L]
@gaboesquivel
gaboesquivel / second.css
Last active December 11, 2015 02:29
Media Queries for Standard Devices
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
$ ->
add_click_to_clicktale_playback = (element) ->
ClickTaleExec("jQuery('#{window.getXPathFor(element)}').click()")
# $("#load_more .button").on "click", ->
# add_click_to_clicktale_playback($(this))
# $("#tabs .tabs_titles li a").on "click", ->
# add_click_to_clicktale_playback($(this))
if Rails.env.production?
PAYPAL_ACCOUNT = 'production@gmail.com'
else
PAYPAL_ACCOUNT = 'development@gmail.com'
ActiveMerchant::Billing::Base.mode = :test
end
/* Commonly used mixins for CSS3 in SASS
by Ben Sargent (2012)
www.brokendigits.com
*/
/* generically prefix any property name */
@mixin prefix($name, $value) {
-webkit-#{$name}: $value;
-moz-#{$name}: $value;
window.track = (event_name, event_description) ->
analytics.track(event_name) unless typeof analytics == 'undefined'
mixpanel.track(event_name) unless typeof mixpanel == 'undefined'
ga_track_event(event_name, event_description)
window.logActionKPI = (name) ->
$.get "/api/kpis/log_action", { kpi: { name: name } }
$ ->
window.track = (event_name, event_description) ->
analytics.track(event_name) unless typeof analytics == 'undefined'
mixpanel.track(event_name) unless typeof mixpanel == 'undefined'
ga_track_event(event_name, event_description)
window.logActionKPI = (name) ->
$.get "/api/kpis/log_action", { kpi: { name: name } }
$ ->
/**
* Inspired by AngularJS' implementation of "click dblclick mousedown..."
*
* This ties in the Hammer events to attributes like:
*
* hm-tap="add_something()"
* hm-swipe="remove_something()"
*
* and also has support for Hammer options with:
*