Skip to content

Instantly share code, notes, and snippets.

View parties's full-sized avatar

Eric Ogden parties

View GitHub Profile
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@parties
parties / responsive-fitted-table.jsx
Last active March 13, 2020 20:02
Responsive Wrapper for Facebook's Fixed Data Table
var React = require('react');
var {Table} = require('fixed-data-table');
var _ = require('lodash');
var FittedTable = React.createClass({
getInitialState() {
return {
tableWidth : 400,
tableHeight : 400
};
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
[*.{js,less}]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@parties
parties / Razer Synapse Yosemite.md
Created March 4, 2016 18:14 — forked from tdegrunt/Razer Synapse Yosemite.md
How to fix Razer Synapse in Mac OSX 10.0 Yosemite

How to fix Razer Synapse in Mac OSX 10.0 Yosemite

Start Terminal.app and type:

sudo nvram boot-args="kext-dev-mode=1"

Verify that command works by typing:

sudo nvram -p | grep -i boot-args
@parties
parties / getStorageSize.js
Last active September 29, 2016 20:28
count characters in local storage
var getStorageSize = function() {
return Object.keys(window.localStorage).map(function(key) {
return window.localStorage.getItem(key).length;
}).reduce(function(prev, curr) {
return prev + curr;
});
};
@parties
parties / css-attribute-selectors-cheat-sheet.css
Created February 14, 2017 20:36
CSS Attribute Selectors Cheat Sheet
/* Courtesy of MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors */
div[attr] { /* "has attr" - element contains 'attr' attribute, value does not matter. */ }
div[attr=value] { /* "exactly" - attr is exactly value. */ }
div[attr~=value] { /* "contains" - attr is a whitespace-separated list of words, one of which is "value". */ }
div[attr|=value] { /* "exactly or begins with `value-` - attr can be exactly "value", or it can _begin_ with "value" immediately followed by “-” (U+002D). */ }
div[attr^=value] { /* "starts with" - attr's _first_ value is prefixed by "value". */ }
div[attr$=value] { /* "ends with" - attr's _last_ value is suffixed by "value". */ }
div[attr*=value] { /* "contains" - attr contains at least one occurrence of "value" as a substring. */ }
div[attr(~|^$*)=value i] { /* "case-insensitive <query>" - applies a case-insensitive search on the query (any of the above examples will work, just end the selector with 'i' */ }
@parties
parties / renameReactJsToJsx.sh
Last active April 11, 2024 06:28
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
@parties
parties / docker-shortcuts.sh
Created July 3, 2019 04:20
some docker delete shortcuts
alias docker_rm_containers='docker rm $(docker ps -a -q)'
alias docker_rm_dangling='docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null'
alias docker_kill_all='docker kill $(docker ps -a -q)'
alias docker_rm_images='docker rmi $(docker images -a -q)'
alias docker_danger_rm_all='docker rmi $(sudo docker images -aq) --force'
@parties
parties / machine.js
Created October 28, 2019 16:55
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions