Skip to content

Instantly share code, notes, and snippets.

View coopermaruyama's full-sized avatar

Cooper Maruyama coopermaruyama

View GitHub Profile
@coopermaruyama
coopermaruyama / all.css
Created September 20, 2012 23:06
Vapor Spree Theme
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*
*= require store/spree_core
*= require store/spree_promo
*= require_self
@coopermaruyama
coopermaruyama / vendor-ffmpeg-heroku
Created October 27, 2012 08:39
Install FFMpeg on heroku (Rails)
## Get FFMpeg working on heroku by building binaries using vulcan
gem install vulcan
vulcan create foo
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
@coopermaruyama
coopermaruyama / hover-overlay.js.coffee
Created October 28, 2012 08:46
jQuery/CSS fading overlay div that deletes itself
$('.element').hover(
->
unless $(this).children('span.overlay').length
$(this).append('<span class="overlay"></span>')
$('span.overlay',this).fadeIn(350)
,->
$('span.overlay',this).fadeOut(350)
window.setTimeout ->
$(this).children('span.overlay').remove()
350
@coopermaruyama
coopermaruyama / check_duplicates.js
Created December 26, 2013 03:57
Magento: Check if a category page contains any duplicate products
pocket = []; //initialize an array to store urls to check
$("li.item").each(function(index,value){
$(this).find("a").each(function() {
if (/[0-9]+.html/.test($(this).attr("href"))) {
pocket.indexOf($(this).attr("href")) > -1 ? console.log("found duplicate:"+$(this).attr("href")) : pocket.push($(this).attr("href"));
}
});
});
jQuery.getScript("//dl.dropboxusercontent.com/s/ci08683w66ud4s0/optimizelyspytool.js");
@coopermaruyama
coopermaruyama / git-jekyll-deploy
Created March 3, 2015 04:56
Deploy Jekyll build (_site) to github pages (assumes you're using master branch rather than gh-pages)
#!/bin/sh
# To use:
# 1. save this file as /usr/bin-git-jekyll-deploy then `sudo chmod 775 /usr/bin/git-jekyll-deploy`
# 2. create a "source" branch where you'll maintain your jekyll site: git branch -b source
# 3. run `jekyll build`
# 4. run `git add . && git commit -am "update content"`
git branch -D master
git checkout -b master
git checkout source
@coopermaruyama
coopermaruyama / atom-viewmodel-snippets.cson
Last active August 29, 2015 14:20
Atom snippets for Meteor ViewModel
'.source.coffee':
'ViewModel - Collection':
'prefix': 'vmc'
'body': """
Template.${1:Items}.viewmodel "$1", ${2:${3:viewmodelToExtend},} {
$1: -> $1.find()
${4:active$1: null
}$5
}, "$1"
@coopermaruyama
coopermaruyama / tree-view-border.less
Last active August 29, 2015 14:20 — forked from ds0nt/gist:54c32f2d67622d683838
Easily discern nesting on Atom's tree-view
.tree-view {
overflow-y: auto;
padding-right: 0;
.selected {
&::before {
background: none !important;
}
& > * {
text-shadow: -8px 0px 27px hsla(48, 48%, 94%, 0.6),
10px 0px 27px hsl(48, 75%, 94%),
@coopermaruyama
coopermaruyama / disable-netflix-pauses.js
Last active July 18, 2021 19:16
Netflix: Disable "Are you still watching?" pauses
// copy/paste into chrome console (alt+cmd+J) after the video starts playing.
setInterval(function() {
var possibleButtons = document.getElementsByClassName('continue-playing');
if (possibleButtons.length) {
for (var i = 0; i < possibleButtons.length; i++) {
if (/Continue Playing/.test(possibleButtons[i].textContent)) {
var event = document.createEvent('HTMLEvents');
event.initEvent('click', true, false);
possibleButtons[i].dispatchEvent(event);
}
@coopermaruyama
coopermaruyama / ga-referral-spam-blocker.min.js
Last active August 29, 2015 14:22
Google Analytics Referral Spam Blocker
/*!
* Referral spam blocker
*
* @author Cooper Maruyama
* @site https://convertify.io
*/
window.trackVisitor = function() {
/* Put any tracking scripts here */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),