This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin) | |
CATALINA_HOME=/Library/Tomcat | |
function shutdown() { | |
date | |
echo "Shutting down Tomcat" | |
$CATALINA_HOME/bin/catalina.sh stop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Now with less jquery | |
//1) go to your my-list page, and scroll to the bottom to make sure it's all loaded: | |
//http://www.netflix.com/browse/my-list | |
//2) Next, paste this in your developer tools console and hit enter: | |
[...document.querySelectorAll('.slider [aria-label]')].map(ele => ele.getAttribute('aria-label')) | |
//or use this to copy the list to your clipboard: | |
copy([...document.querySelectorAll('.slider [aria-label]')].map(ele => ele.getAttribute('aria-label'))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a.sharebutton.twitter').click(function(e){ | |
window.open("https://twitter.com/intent/tweet?text=" + encodeURIComponent($('meta[name="twitter:description"]').attr('content').substring(0, 116)) + "&url=" + encodeURIComponent(window.location.href),"tweet", "width=500,height=300"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var cheerio = require('cheerio') | |
var recursive = require('recursive-readdir'); | |
var fs = require('fs'); | |
recursive('.', function (err, files) { | |
// Files is an array of filename | |
for(f = 0; f < files.length; f++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
#usage: wt [title name] | |
#deselect all the options for window and tab titles in the iterm->preferences->appearance section. And in the .zshrc uncomment/add export DISABLE_AUTO_TITLE="true" | |
#via http://superuser.com/questions/292652/change-iterm2-window-and-tab-titles-in-zsh | |
echo -ne "\e]1;$1\a" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# /etc/init.d/ngrok | |
case "$1" in | |
start) | |
echo "Ngrok service is starting" | |
screen -d -m /usr/local/bin/ngrok start -all -config /home/pi/.ngrok2/ngrok.yml | |
echo "Ngrok service was started" | |
;; | |
stop) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//map a range from one to another, protecting limits | |
Number.prototype.map = function(in_min, in_max, out_min, out_max) { | |
var output = (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; | |
if (out_max > out_min && output < out_min) | |
output = out_min; | |
if (out_max > out_min && output > out_max) | |
output = out_max; | |
if (out_max < out_min && output < out_max) | |
output = out_max; | |
if (out_max < out_min && output > out_min) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//based on Bootstrap 3 standard media queries | |
//make a new bookmark and add this: | |
javascript: var width = document.body.clientWidth;if (width < 480) { console.log('screen-xs', width);} else if (width < 768) { console.log('screen-sm', width);} else if (width < 992) { console.log('screen-md', width);} else if (width < 1200) { console.log('screen-lg', width);} else { console.log('screen-xl', width);} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Calculates current em size in pixels, tests current Foundation 5 media query size and logs it in the console | |
//Create a new bookmark and paste this as the URL: | |
javascript: var width = document.body.clientWidth;var em = parseFloat(getComputedStyle(document.body).getPropertyValue('font-size'));if (width < 40 * em) { console.log('small', width);} else if (width < 64 * em) { console.log('medium', width);} else if (width < 90 * em) { console.log('large', width);} else if (width < 120 * em) { console.log('xlarge', width);} else { console.log('xxlarge', width);} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(true): | |
echo "Are you sure you want to do this? Type 'yes' to continue: "; | |
$handle = fopen ("php://stdin","r"); | |
$line = fgets($handle); | |
if(trim($line) == 'yes'){ | |
break; | |
} | |
endwhile; | |
fclose($handle); | |
echo "\n"; |
OlderNewer