Skip to content

Instantly share code, notes, and snippets.

View awkale's full-sized avatar
📈
developing

Alex Kale awkale

📈
developing
View GitHub Profile
@awkale
awkale / list_all.rb
Created November 4, 2015 01:40
list all entries of a model in a nice format
pp Product.all.to_a
# Product is model name
# outputs:
Product Load (0.2ms) SELECT "products".* FROM "products"
[#<Product:0x007fb738028810
id: 1,
name: "Alex",
price: #<BigDecimal:7fb7380221e0,'0.123E3',9(27)>,
created_at: Wed, 04 Nov 2015 01:30:32 UTC +00:00,
updated_at: Wed, 04 Nov 2015 01:30:32 UTC +00:00>,
@awkale
awkale / css-order.md
Last active July 31, 2024 17:07
#CSS Declaration order

css property order

Related property declarations should be grouped together following the order:

  1. Positioning
  • position
  • top
  • right
  • bottom
  • left
  • z-index
@awkale
awkale / visited.js
Created June 3, 2015 19:08
advanced :visited styles
localStorage.setItem('visited-'+window.location.pathname,true);
var links = document.getElementsByTagName('a');
for (i=0;i<links.length;i++) {
var link = links[i];
if (link.host == window.location.host
&& localStorage.getItem('visited-' + link.pathname + '/')) {
link.dataset.visited = true;
}
}
@awkale
awkale / delete-blank-lines
Created May 29, 2015 19:45
remove blank lines in sublime text with regex
^\n
@awkale
awkale / regex-between.js
Last active May 20, 2016 14:57
use regex to find text between elements - e.g. <h3>
(?s)(?<=<h3>)<span>(.+?)<\/span>
<h5>(.|\n)*?<\/h5>
(?s)<p class="events" style="display: none;">.+?</p>
# find every other comma
(,[^,]*),
@awkale
awkale / delete_auto_url
Last active February 10, 2017 16:44
delete chrome autocomplete URL
Shift+Function+Delete
@awkale
awkale / colon-nospace.md
Last active August 29, 2015 14:16
find colon with no space after
  • find: ([a-zA-Z0-9]:)([a-zA-Z0-9#])
  • replace: $1 $2
@awkale
awkale / ipconfig.sh
Created February 5, 2015 18:58
IP address
ipconfig getifaddr en0
ipconfig getifaddr en1
ipconfig getifaddr en2
ipconfig getifaddr en3 //ethernet
@awkale
awkale / identify
Created November 10, 2014 20:45
find out image details
identify -verbose filename
@awkale
awkale / anchor.css
Created October 7, 2014 15:11
anchor padding - adds padding to jump-to anchors
h2:before {
display: block;
content: " ";
margin-top: -285px;
height: 285px;
visibility: hidden;
}