Skip to content

Instantly share code, notes, and snippets.

@moresheth
moresheth / jsonview_twilight_theme.css
Created May 21, 2020 16:03
Twilight Theme for JSON View Chrome extension
body {
white-space: pre;
font-family: Bitstream Vera Sans Mono, monospace;
font-size: 13px;
background: #1D1D1D;
color: #FFFFFF;
}
body li, body div {
border: 1px solid transparent;
@moresheth
moresheth / _datetime_picker.erb
Last active December 19, 2015 15:09
Simple datetime picker that uses native controls if available, or uses the jQuery UI picker for the date portion if not. It also uses the Resig microtemplating for the template part.
<!--
This is the Rails partial (include) that has the HTML fields.
You pass in an id_prefix and name_prefix, to keep the form elements unique.
And optionally pass in a set_date variable to have the default date.
-->
<span data-action="timechanger">
<!-- Attempt to use native date picker. -->
<input class="datefield" data-timechangerdate="true" type="date" id="<%= id_prefix %>_date" name="<%= name_prefix %>_date" value="<%= set_date.to_s(:sitemap_date) if set_date.present? %>" />
@moresheth
moresheth / preferences.txt
Created March 3, 2013 15:38
Modified lines in preferences.txt (file location seen in program preferences window), and /Applications/Arduino.app/Contents/Resources/Java/lib/theme/theme.txt
editor.font=Bitstream Vera Sans Mono,plain,12
editor.antialias=true
@moresheth
moresheth / add.js
Last active December 11, 2015 08:29
This is a simple function to add up any numbers fed into the arguments: add( 1, 2.2, '3', true, 'monkey');
function add() {
var total = 0,
max_decimal = 0;
for (var i=0,l=arguments.length;i<l;i++) {
var num = parseFloat( arguments[i] ),
arr = ( num + '' ).split('.'),
dec = ( arr[1] == undefined ? 0 : arr[1].length );
@moresheth
moresheth / caveman_time.js
Created April 27, 2012 17:03
Caveman time formatting in Javascript
function formatTime( seconds ) {
seconds = Math.round( seconds );
var hours = 0,
minutes = 0;
while (seconds >= 3600) {
hours += 1;
seconds -= 3600;
}
while (seconds >= 60) {
minutes += 1;
@moresheth
moresheth / caveman_time.rb
Created April 27, 2012 16:58
Convert seconds to extended time
# Caveman
def seconds_to_extended(seconds)
hours = 0
minutes = 0
while seconds >= 3600
hours += 1
seconds -= 3600
end
while seconds >= 60
minutes += 1
@moresheth
moresheth / reset.css
Created April 24, 2012 19:26
CSS Reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
strike, strong, sub, sup, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
@moresheth
moresheth / gist:1780549
Created February 9, 2012 15:08
Mixin Example
@mixin border_radius($radius: 10px) {
-webkit-border-radius: $radius;
-khtml-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
-o-border-radius: $radius;
border-radius: $radius;
}
@moresheth
moresheth / microtemplating.js
Created October 12, 2011 16:31
John Resig's MicroTemplating with Curly Braces
/*
This comes directly from John Resig's MicroTemplating, but with {%= %} instead of <%= %> for the dynamic sections.
http://ejohn.org/blog/javascript-micro-templating/
This lets you use just natural Javascript, along with whatever JS library you're using, and can be inside of a Rails erb template, or whatever.
Used with a template inside the HTML of the page:
<script type="text/html" id="user_tmpl">