Skip to content

Instantly share code, notes, and snippets.

View jsalazar's full-sized avatar
🏖️
Here for a good time, not a long time.

Jake Salazar jsalazar

🏖️
Here for a good time, not a long time.
View GitHub Profile
@jsalazar
jsalazar / gist:1504646
Created December 21, 2011 04:54
Big Menu jQuery
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ::::::::::::::::::: GIANT MAJORS MENU FOR SCHOOLS ::::::::::::::::::::::::::::
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var schoolMenuContainers = $('div#schoolMenuContainer > div.schoolMenu');
// ON CLICK
$('.schoolBox, .menuActi').click(function () {
var cVisible = $('#schoolMenuContainer').is(':visible');
$('#schoolMenuPreview').slideUp('slow'); // hide the preview
@jsalazar
jsalazar / Postgres extract year from timestamp query
Created February 4, 2014 06:29
Grab click tracker records by year from a timestamp....(Postgres)
SELECT DISTINCT click_linkid, count (*) as count, click_campaign, click_linkurl
FROM click_tracker
where extract(YEAR from TIMESTAMP WITH TIME ZONE 'epoch' + click_timestamp * INTERVAL '1 second') = 2009
GROUP BY click_linkid, click_campaign, click_linkurl
ORDER BY click_campaign, count DESC ";
@jsalazar
jsalazar / Postgres typecasting, grouping, ordering
Created February 4, 2014 06:31
Typecasting in Postgres::numeric
select distinct click_hour::numeric, click_year, count(*) as count
from click_tracker
where click_linkid = '12345678' and click_day_of_year = '88'
group by click_hour, click_year
order by click_year, click_hour::numeric;
@jsalazar
jsalazar / sumFunction.js
Last active August 29, 2015 13:57
array object prototype testing
Array.prototype.sum = function() {
if (this instanceof Array) {
return this.reduce(function(a,b) {
return a+b;
});