Skip to content

Instantly share code, notes, and snippets.

@stinoga
stinoga / README.md
Last active Mar 22, 2018
My ZSH Theme
View README.md

Rob's ZSH Theme

A ZSH theme optimized for people who use:

  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Monaco)

For Mac users, I highly recommend iTerm 2. I used the default colors but this also works well with Solarized Dark. The dots by the purple branch name denote the current git status:

  • Green: added files.
@stinoga
stinoga / removeStyles.js
Created Mar 16, 2018
Remove all stylesheets for Accessibility checking without CSS
View removeStyles.js
(() => {
Array.from(document.querySelectorAll('link, style')).forEach(el => {
el.parentNode.removeChild(el);
});
})();
@stinoga
stinoga / component.js
Created Dec 6, 2016
React custom Proptype function to check if another prop is defined
View component.js
function requiredIfNotHidden(props, propName, componentName) {
if (!props['hiddenLabel']) {
let value = props[propName];
// If no hidden label is set, children are required for accessibility
if (typeof value === undefined) {
return new Error(`Required prop '${propName}' was not specified in '${componentName}'. It is required if the 'hiddenLabel' prop is not set for accessibility
}
}
@stinoga
stinoga / .eslintrc
Created Feb 8, 2016
Eslint configuration
View .eslintrc
{
"rules": {
"indent": [
2,
2
],
"quotes": [
2,
"single"
],
@stinoga
stinoga / list.py
Created Oct 1, 2015
List Arguments in Python
View list.py
import inspect
def func(a, b, c):
frame = inspect.currentframe()
args, _, _, values = inspect.getargvalues(frame)
print 'function name "%s"' % inspect.getframeinfo(frame)[2]
for i in args:
print " %s = %s" % (i, values[i])
return [(i, values[i]) for i in args]
@stinoga
stinoga / console.js
Created Dec 27, 2014
Save console output to a file
View console.js
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
View create_ssh_key.sh
# generate ssh key
ssh-keygen -t rsa
# copy public key to clipboard
pbcopy < ~/.ssh/id_rsa.pub
@stinoga
stinoga / console.js
Last active Aug 29, 2015
Get Titles on the Page (jQuery)
View console.js
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();
var array = []
$(".title > a").each(function() {
array.push($(this).text());
});
@stinoga
stinoga / command.sh
Last active Aug 29, 2015
Sublime Command line
View command.sh
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin
@stinoga
stinoga / lazyDirective.js
Last active Jan 4, 2016
Angular Lazy Load
View lazyDirective.js
// Lazy load directive, taken from http://slid.es/djsmith/deep-dive-into-custom-directives
directive('myLazyLoad', function() {
return {
transclude: 'element',
priority: 1200, // changed needed for 1.2
terminal: true,
restrict: 'A',
compile: function(element, attr, linker) {
return function (scope, iterStartElement, attr) {
You can’t perform that action at this time.