Skip to content

Instantly share code, notes, and snippets.

@stinoga
stinoga / README.md
Last active March 22, 2018 20:44
My ZSH Theme

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 March 16, 2018 17:35
Remove all stylesheets for Accessibility checking without CSS
(() => {
Array.from(document.querySelectorAll('link, style')).forEach(el => {
el.parentNode.removeChild(el);
});
})();
@stinoga
stinoga / component.js
Created December 6, 2016 20:04
React custom Proptype function to check if another prop is defined
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 February 8, 2016 17:30
Eslint configuration
{
"rules": {
"indent": [
2,
2
],
"quotes": [
2,
"single"
],
@stinoga
stinoga / list.py
Created October 1, 2015 22:01
List Arguments in Python
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 December 27, 2014 22:18
Save console output to a file
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
# generate ssh key
ssh-keygen -t rsa
# copy public key to clipboard
pbcopy < ~/.ssh/id_rsa.pub
@stinoga
stinoga / console.js
Last active August 29, 2015 13:57
Get Titles on the Page (jQuery)
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 October 23, 2023 16:16
Sublime Command line
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin
@stinoga
stinoga / lazyDirective.js
Last active January 4, 2016 21:19
Angular Lazy Load
// 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) {