Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
module ApplicationHelper | |
# a helper to get a data uri for an image asset | |
# e.g. <img src="<%= asset_data_uri('facebook.png') %>" /> | |
def asset_data_uri(path) | |
asset = asset_paths.asset_for path, nil | |
base64 = Base64.encode64(asset.to_s).gsub(/\s+/, "") | |
"data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}" | |
end | |
end |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
Ctrl+C | copy current line (if no selection) |
Ctrl+X | cut current line (if no selection) |
Ctrl+⇧+K | delete line |
Ctrl+↩ | insert line after |
/** | |
* For modern browsers | |
* 1. The space content is one way to avoid an Opera bug when the | |
* contenteditable attribute is included anywhere else in the document. | |
* Otherwise it causes space to appear at the top and bottom of elements | |
* that are clearfixed. | |
* 2. The use of `table` rather than `block` is only necessary if using | |
* `:before` to contain the top-margins of child elements. | |
*/ | |
.cf:before, |
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |
#define _XOPEN_SOURCE | |
#include <ctype.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
int yell_args(int argc, char** argv); | |
short is_password(const char* plain, const char* salt, const char* cipher); | |
short dict_attack(const char* salt, const char* cipher); |
All of these resources were extremely valuable as I researched regex, finite state machines, and regex in Ruby. Check them out, they're full of fantastic information! | |
Articles | |
"Exploring Ruby's Regular Expression Algorithm" by Pat Shaughnessy | |
http://patshaughnessy.net/2012/4/3/exploring-rubys-regular-expression-algorithm | |
"Finite State Machines and Regular Expressions" by Eli Bendersky | |
http://www.gamedev.net/page/resources/_/technical/general-programming/finite-state-machines-and-regular-expressions-r3176 | |
"Regular Expression Matching Can Be Simple and Fast" by Russ Cox |
When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.
Raw Attribute Strings
<div my-directive="some string" another-param="another string"></div>
<?php | |
function foo($a, $b) { | |
echo "a: {$a} b: {$b}\n"; | |
} | |
$foo_caller = new PartialCallable('foo', array('A')); | |
$foo_caller('B'); | |
$foo_caller = partial_function('foo', 'A'); | |
$foo_caller('B'); |
The MIT License (MIT) | |
Copyright (c) 2015 Justin Perry | |
Permission is hereby granted, free of charge, to any person obtaining a copy of | |
this software and associated documentation files (the "Software"), to deal in | |
the Software without restriction, including without limitation the rights to | |
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |