Skip to content

Instantly share code, notes, and snippets.

@stevenocchipinti
stevenocchipinti / Person.js
Last active July 22, 2021 07:47
A simple demonstration of classes in es6
//
// Person.js
//
// This is a simple Person class.
//
// It doesn't do much, but it demonstrates the use of ES6 classes. Note that
// this code will most likely not work in old browsers directly. To 'compile'
// this down to the more widely accepted ES5, you could use Babel.
//
@stevenocchipinti
stevenocchipinti / person.rb
Created June 28, 2016 07:47
A simple demonstration of classes in Ruby
#
# person.rb
#
# This is a simple Person class
# It really doesn't do much, but it demonstrates the use of classes in Ruby
#
class Person
@stevenocchipinti
stevenocchipinti / lorem6.txt
Created June 23, 2016 06:20
Lorem Ipsum (6 paragraphs)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ut fringilla nunc. Vestibulum ut ligula a est ultrices ultricies quis id tellus. Mauris eu dignissim nisi. Phasellus id magna vehicula, egestas tellus non, accumsan lectus. Vivamus sed tincidunt augue. In consequat sed erat et pretium. Sed nec ante pulvinar, convallis quam eget, placerat urna.
In eu lacus mattis, ultrices erat a, aliquam est. Aenean commodo quam vel sapien gravida tincidunt. Suspendisse potenti. Proin sed libero sed enim varius elementum. Duis blandit euismod ante, eu pharetra dui fermentum vel. Etiam hendrerit sit amet metus eget maximus. Aliquam erat volutpat. Nullam tortor enim, dapibus eu accumsan ut, finibus eu purus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam velit lectus, laoreet et mauris bibendum, viverra imperdiet lorem. Cras vitae purus eu nulla pharetra suscipit. Fusce arcu eros, accumsan vel est in, ultrices pretium ipsum. Suspendisse potenti. Morbi aliquet justo id rh
@stevenocchipinti
stevenocchipinti / config.ru
Created August 26, 2015 04:06
Rack hello world
run ->(env) {
[ 200, { 'Content-Type' => 'text/plain' }, [ "Hello World" ] ]
}
@stevenocchipinti
stevenocchipinti / json_logger.rb
Created May 14, 2015 14:14
Logging in JSON with Ruby/Rails
require 'logger'
require 'time'
require 'json'
require 'forwardable'
# A simple subclass that writes JSON logs
class JsonLogger < Logger
def format_message(severity, timestamp, progname, msg)
msg = {message: msg} unless msg.is_a? Hash
log = {timestamp: timestamp.iso8601, severity: severity}.merge(msg)
@stevenocchipinti
stevenocchipinti / NOTES.md
Last active July 28, 2017 20:56
Notes and observations while trying to learn ReactJS

ReactJS Notes

  • React is cool :)
    • props are passed and do not change
    • state is initally configured but can change
    • JSX is optional but needs to be compiled - its very helpful!
    • JSX and ES6 can be used freely with babel via webpack/browserify/etc.
    • Lots of resources available online
  • Big list of links
@stevenocchipinti
stevenocchipinti / remote.xml
Created April 4, 2015 11:37
Kodi remote debugging keymap
<!--
kindly provided by 'Knapster'
Ref: http://forum.kodi.tv/showthread.php?tid=139145&pid=1285390#pid1285390
-->
<keymap>
<global>
<remote>
<channelplus>Notification(Keypress, channelplus, 1)</channelplus>
<channelminus>Notification(Keypress, channelminus, 1)</channelminus>
@stevenocchipinti
stevenocchipinti / contentscript.js
Created December 3, 2014 12:43
Simple "Content Script" Google Chrome extension
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
// remote script has loaded
};
script.src = '//hi.kickassapp.com/kickass.js';
d.getElementsByTagName('head')[0].appendChild(script);
}(document));
@stevenocchipinti
stevenocchipinti / ifconfig.rb
Created September 2, 2014 07:17
Parse ifconfig
`ifconfig`.split(/^(?=\w)/).flat_map{|x| x.scan(/^(\w+).*inet ([0-9.]+)/m)}
#=> [["lo0", "127.0.0.1"], ["en0", "10.112.202.44"], ["vboxnet0", "192.168.59.3"], ["en4", "10.112.197.80"]]
@stevenocchipinti
stevenocchipinti / troll.sh
Last active August 29, 2015 14:00
Troll
export PS1="\$(osascript -e 'set Volume 10' && say 'jerk')$PS1"