Skip to content

Instantly share code, notes, and snippets.

View luc4leone's full-sized avatar
💭
🗻

Luca Leone luc4leone

💭
🗻
  • Italy
View GitHub Profile
def hello
"Hello world"
end
def add(a,b)
a + b
end
add(1,2)
p add(1,2)
# url = web address
# text = the link
def link(url, text)
"<a href=#{url}>#{text}</a>"
end
p link("http://dontpuzzle.me", "my web site")
# the Output is:
# "<a href=http://dontpuzzle.me>my web site</a>"
@luc4leone
luc4leone / perfect_squares
Created May 30, 2014 20:04
Given an array of numbers, which are perfect squares?
def get_squares(n)
n.to_a
squares = []
n.each do |i|
if (i ** 0.5).to_s[-2..-1] == ".0"
if squares.include? i
squares
else
squares.push(i)
end
<h1>New Post</h1>
<div class="row">
- <div class="col-md-6">
+ <div class="col-md-4">
<p>Guidelines for posts</p>
<ul>
<li>Make sure the it rhymes.</li>
@luc4leone
luc4leone / modifying arrays
Created February 24, 2015 20:51
khan intro to js, lesson on modifying arrays
// x positions of baloons and ropes
var xPositions = [100, 200];
//when i want more than 1 baloon i need to create
//a variable that grows
var newInd = 2;
var draw = function(){
if (mouseIsPressed){
xPosition[newInd] = mouseX;
newInd++;
var model = {
currentCat: null,
cats: [
{
catName: "joe",
catCount: 0,
imgSource: "img/cat0.jpg"
},
{
' CICLO TACCHE ---------------------------------------------------------------------------------------------------------
strNotches = ""
Dim dvNotches As New DataView(gdtSegment)
dvNotches.RowFilter = "IdPattern = " & shtCSVPattern & " AND SegType = 10"
dvNotches.Sort = "SegSeq"
<RecordType id="002">
<NameSize>A</NameSize> <!--Taglie componenti codice-->
<CodeSize>48@M1#1,50@M1#1</CodeSize> <!--Taglie componenti-->
<MarkerName>A.gbr</MarkerName> <!--Nome del marker-->
<Length>101</Length> <!--Lunghezza del marker in cm-->
<OverlapsMarker>34,45</OverlapsMarker> <!--splice in cm-->
</RecordType>
@luc4leone
luc4leone / runWithDebugger.js
Last active March 30, 2017 08:20
my solution to Watch and Code challenge #1: 'Improving runWithDebugger'
// my solution
// I copied the name of the first parameter from Ben Baik solution because
// it's a great choice. Maybe it's redundant because 'runWithDebugger' is
// already meaningful. I take no risk: redundant maybe, but superclear! :-)
function runWithDebugger(functionToDebug, functionToDebugArgs) {
debugger;
functionToDebug.apply(null, functionToDebugArgs);
}