Skip to content

Instantly share code, notes, and snippets.

View czxtm's full-sized avatar
💭
{d'}

cooper czxtm

💭
{d'}
View GitHub Profile
@czxtm
czxtm / git-notes.sh
Last active August 29, 2015 14:25
Git Notes
# ---------------------------------------------------
# Correct workflow when working with forked upstreams.
# ---------------------------------------------------
git fetch origin --prune
# If you haven't made any local changes:
git checkout branch-name
git merge --ff-only origin/branch-name
# If you have local changes, you'll get this error: fatal: Not possible to fast-forward, aborting.
@czxtm
czxtm / zshnotes.zsh
Created July 18, 2015 20:12
ZSH Notes
# Using redirection, run a command only if the previous command's exit code is 0,
command &>/dev/null && conditionalcommand
# example:
tmux has-session -t mysession &>/dev/null && echo "mysession exists!"
@czxtm
czxtm / 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),
@czxtm
czxtm / disable-netflix-pauses.js
Last active February 4, 2025 13:37
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);
}
@czxtm
czxtm / 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%),
@czxtm
czxtm / 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"
@czxtm
czxtm / 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
jQuery.getScript("//dl.dropboxusercontent.com/s/ci08683w66ud4s0/optimizelyspytool.js");
@czxtm
czxtm / 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"));
}
});
});
@czxtm
czxtm / 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