Skip to content

Instantly share code, notes, and snippets.

@Ahnita
Ahnita / cat.rb
Last active August 29, 2015 14:25
Object Oriented Programming I and II
class Cat
attr_reader :color, :breed
attr_accessor :name
def initialize(color, breed)
@color = color
@breed = breed
@hungry = true
end
def feed(food)
puts "Mmmmm, " + food + "!"
@Ahnita
Ahnita / posts.js
Last active August 1, 2016 07:13
To create posts using JS
var main =function() {
$('.btn').click(function() {
var post = $('status-box').val();
$('<li>').text(post).prependTo('.posts');
$('.status-box').val('');
$('.counter').text('140');
});
$('.status-box').keyup(function() {
var postLength = $(this).val().length;
var charactersLeft = 140 - postLength;
@Ahnita
Ahnita / MapBuilder Script
Last active December 9, 2018 09:51
Google API
google.maps.event.addDomListener(window, 'load', init);
var map;
function init() {
var mapOptions = {
center: new google.maps.LatLng(MY COORDINATES),
zoom: 15,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.DEFAULT,
},