Skip to content

Instantly share code, notes, and snippets.

View lisp.rb
require 'pry'
class Test
attr_reader :list
def initialize
@list = []
end
def mult(n, m)
@iacutone
iacutone / pi.md
Last active Jan 5, 2020
Raspberry Pi
View pi.md

BTSync

  1. Install instructions
  2. service resilio-sync start

AFP File Sharing

  1. sudo apt-get install netatalk
  2. sudo /etc/init.d/netatalk stop
  3. sudo vi /etc/netatalk/AppleVolumes.default
  4. ~/ "<some dir name>"
  5. sudo /etc/init.d/netatalk start
View counter.elm
import Html exposing (..)
import Html.Events exposing (onClick)
main: Program Never Model Msg
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
View gist:e9d14e863df83336a864e9da0ad1e9eb
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.timemachine-backup</string>
<key>ProgramArguments</key>
<array>
<string>/Users/iacutone/scripts/timemachine-backup</string>
</array>
View dynamic_modals.js
(function($) {
var options = { show: false };
var $modal = $('#tag-modal');
// Initialize the modal
$modal.modal(options);
$modal.on('hidden', function() {
resetTagModal();
View migration.rb
class DowncaseEmailAddresses < ActiveRecord::Migration
def up
# Downcase all User emails
User.update_all('email = LOWER(email)')
# Downcase all ContactRequest emails
ContactRequest.update_all('email_address = LOWER(email_address)')
# Downcase all Reservation emails
Reservation.update_all('renter_email = LOWER(renter_email)')
View animated_form.js
$('a.next').on("click", function(){
var h3 = $("h3.active").text();
switch (h3) {
case "1. Select Your Organization":
$('div.your_org').children('h3').removeClass('active');
$('div.your_info').children('h3').addClass('active');
$('.your_info').slideDown('slow');
$('.your_org').slideUp('slow');
$('a.back').show();
@iacutone
iacutone / view.html.haml
Created Jan 6, 2014
add column heading to a table
View view.html.haml
:javascript
$('<th>'+ 'Total' +'</th>').insertAfter('th:last');
View row_adder.js
function removeCommas(str) {
return(str.replace(/,/g,''));
}
filterInt = function (value) {
if(/^\-?([0-9]+|Infinity)$/.test(value))
return Number(value);
return NaN;
}
View get.js
jQuery.get('/organizations/' + org_id + '/free_quantities', function(data) {
$('.span2').on('change', function(){
var input_value = $('input.span2').val();
var total_quant_in_stock_diff = data.total_in_stock - input_value;
var total_available_free_for_user = data.free_available - input_value;
$('.show_quantity_left').append('<p class="quantity_left">('+ (total_quant_in_stock_diff) +' in stock)</p>');
if ((total_available_free_for_user + 1) > 0){
You can’t perform that action at this time.