most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| #/usr/bin/env ruby | |
| require 'nokogiri' | |
| require 'open-uri' | |
| doc = Nokogiri::HTML(open('https://medium.com')) | |
| urls = doc.at_css('.cover-img')["style"].scan(/\('([^\)]*)'\)/) | |
| image_src = 'http:'+urls[0][0] | |
| ext = image_src.split('.').last | |
| random = rand(2**256).to_s(36)[0..7] | |
| download_path = "/tmp/#{random}.#{ext}" |
| ZSH=$HOME/.oh-my-zsh | |
| ZSH_THEME="kphoen" | |
| export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking | |
| export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold | |
| export LESS_TERMCAP_me=$'\E[0m' # end mode | |
| export LESS_TERMCAP_se=$'\E[0m' # end standout-mode | |
| export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box | |
| export LESS_TERMCAP_ue=$'\E[0m' # end underline |
| <!doctype html> | |
| <html> | |
| <title>400 Error</title> | |
| <style> | |
| body{text-align:center;position:absolute;width:100%;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);transform:translate(-50%,-50%);} | |
| h2,h3{color:#555;font:bold 200%/100px sans-serif;margin:0} | |
| h3,p{color:#777;font:normal 150% sans-serif} | |
| p{font-size: 100%;font-style:italic;margin-top:2em;} | |
| </style> | |
| <h2>we didn't understand the request</h2> |
| <?php | |
| function is_federal_holiday(DateTime $date){ | |
| $year = $date->format('Y'); | |
| $federal_holidays = array_map(function($date_string) use($year){ | |
| $date = new DateTime($date_string . ' ' . $year); | |
| if ($date->format('l') === 'Saturday') $date->modify('-1 day'); | |
| if ($date->format('l') === 'Sunday') $date->modify('+1 day'); | |
| return $date; | |
| }, [ | |
| "january 1", //new year's day |
| function initializeGoogleAnalytics(){ | |
| GoogleAnalytics.init(); | |
| } | |
| var GoogleAnalytics = { | |
| accountId: null, | |
| accessToken: null, | |
| getAccountId: function(){ | |
| return (this.accountId) ? 'ga:'+this.accountId : null; |
| ruby -e "$(curl -fsSkL https://gist.githubusercontent.com/saetia/2369908/raw/4bf9a6d36060582e69f02c314f66449971a7bb11/parse.rb)" /Users/Joel/site.db.121010.dump | |
| ruby parse.rb site.120411.dump |
| #!/bin/bash | |
| if [ $# -eq 0 ]; then | |
| echo -e "Usage: $0 site.com \033[32m'alert'\033[0m js" | |
| exit | |
| fi | |
| if [ ! -d /var/www/${1}/public ]; then | |
| echo -e "\033[31mfailed:\033[0m ${1} does not exist" | |
| exit |
| CREATE TRIGGER `pages_created_at` BEFORE INSERT ON `pages` FOR EACH ROW SET NEW.created_at = UTC_TIMESTAMP(), NEW.updated_at = UTC_TIMESTAMP(), NEW.deleted_at = IF(NEW.deleted_at = "0000-00-00 00:00:00", NULL, NEW.deleted_at) | |
| CREATE TRIGGER `pages_updated_at` BEFORE UPDATE ON `pages` FOR EACH ROW SET NEW.updated_at = UTC_TIMESTAMP(), NEW.created_at = OLD.created_at, NEW.deleted_at = IF(NEW.deleted_at = "0000-00-00 00:00:00", NULL, NEW.deleted_at) |