This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Account | |
attr_reader :name | |
attr_reader :balance | |
def initialize(name, balance=100) | |
@name = name | |
@balance = balance | |
end | |
public | |
def display_balance(pin_number) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Lets make a simple snake game --> | |
<canvas id="canvas" width="450" height="450"></canvas> | |
<!-- Jquery --> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> | |
<script> | |
$(document).ready(function(){ | |
//Canvas stuff | |
var canvas = $("#canvas")[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcd(a, b) | |
return a if b == 0 | |
return b if a == 0 | |
a.gcd(b) | |
end | |
def bezout(a, b) | |
return 1, 0 if b == 0 | |
q, r = a.divmod b | |
s, t = bezout(b, r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
from turtle import* | |
from random import randint | |
speed(100) | |
penup() | |
goto(-140, 140) | |
for step in range(15): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# n here is the 'row', or the whitespace. | |
# height is the height of the tree. | |
def tree(height) | |
height.times do |n| | |
print ' ' * (height - n) | |
puts "\033[32m*\033[0m" * (2 * n + 1) | |
end | |
4.times do | |
puts '#####'.center(41) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\033[1mForeground Colors...\033[0m\n" | |
puts " \033[30mBlack (30)\033[0m\n" | |
puts " \033[31mRed (31)\033[0m\n" | |
puts " \033[32mGreen (32)\033[0m\n" | |
puts " \033[33mYellow (33)\033[0m\n" | |
puts " \033[34mBlue (34)\033[0m\n" | |
puts " \033[35mMagenta (35)\033[0m\n" | |
puts " \033[36mCyan (36)\033[0m\n" | |
puts " \033[37mWhite (37)\033[0m\n" | |
puts '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import turtle | |
# initialization | |
tree = turtle.Turtle() | |
tree.color("green") | |
tree.begin_fill | |
tree.speed(30) | |
tree.penup() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
# first setups | |
import turtle | |
name = "Nicholas" | |
# initialization | |
scrn = turtle.Screen() | |
scrn.bgcolor("#000") | |
scrn.title("New Year 2019!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Exploit the type confusion by first sending a random number, then tamper with the get so | |
* the parameter will become like '?angka[]=yournumber' (add an array notation in the 'angka variable'). | |
*/ | |
?> | |
<!DOCTYPE HTML> | |
<html> | |
<head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Group.js | |
* An algorithm to equally distribute students to the number of available teachers. | |
* Complexity is O(n). | |
* | |
* @input Arrays of teachers and students. | |
* @output Array of objects of grouped students and teachers. | |
* | |
* Run in Node (CommonJS) | |
* How to run: Clone or copy the gist, then do node ./group.js |
OlderNewer