Skip to content

Instantly share code, notes, and snippets.

View j0ni's full-sized avatar
🌑
Off-world

Jon Levin j0ni

🌑
Off-world
View GitHub Profile
class Table
class << self
def say_goodbye
puts "goodbye"
end
def count
@@count ||= 0
end
<html>
<body>
<div id="app"></div>
<script src="https://code.jquery.com/jquery-1.12.3.min.js"></script>
<script>
function startFader(maxId) {
var apiKey = 'a17b202a68d644619d0f4b7d0c4c498b';
return function () {
var url = "https://api.instagram.com/v1/tags/nofilter/media/recent?client_id="
+ apiKey + "&count=1"
<html lang="en">
<head>
</head>
<body>
<table>
<thead>
<tr>
<th>Id</th>
<th>Title</th>
</tr>
module Constants
InitialLives = 3
InitialScore = 0
InitialRecord = 0
RandUpper = 20
RandLower = 1
end
class Question
include Constants
class Player
attr_accessor :name, :score, :lives
def initialize(name)
@lives = 3
@score = 0
@name = name
end
def lose_life
@j0ni
j0ni / bottles.scm
Last active March 3, 2016 04:44
Silly bottles problem
;; You've just been hired at Lighthouse Markets, a reputable (and
;; thoroughly fictional) grocery store chain. One of the primary
;; features of Lighthouse Markets is their recycling program on pop
;; bottles. Here is how the program works:
;; * For every two empty bottles, you can get one free (full) bottle of pop
;; * For every four bottle caps, you can get one free (full) bottle of pop
;; * Each bottle of pop costs $2 to purchase
;; Given these parameters, write a program so that you can figure out
@j0ni
j0ni / form.erb
Created March 2, 2016 22:10
Notes for Jacob
<form method="post" action="/movies/index">
<label>Runtime</label>
<select name="runtime">
<option value="0">Under 90 minutes</option>
<option value="1">Between 90 and 120 minutes</option>
<option value="2">Over 120 minutes</option>
</select>
<label>Title</label>
<input type="text" name="title">
def romans
{"M" => 1000, "D" => 500, "C" => 100, "L" => 50, "X" => 10, "V" => 5, "I" => 1}
end
def find_next_component(num)
romans.select { |l, v| v <= num }
.sort_by { |l, v| v }
.last
end
@j0ni
j0ni / contact.rb
Created January 19, 2016 23:51
An example ORM-like contact class
require 'pg'
class Contact
attr_reader :id, :name, :email
class << self
def connection
@@conn ||= PG.connect(
dbname: 'contact_list',
user: 'yorname',

Dear Jonathan Irving,

The Government has responded to the petition you signed – “Government to abandon all ideas of trying to ban strong encryption.”.

Government responded:

The Government is not seeking to ban or limit encryption. The Government recognises the important role that encryption plays in keeping people’s personal data and intellectual property safe online.

This Government recognises the importance of encryption, which helps keep people's personal data and intellectual property safe from theft by cyber means. It is fundamental to our everyday use of the internet. Without the development of strong encryption allowing the secure transfer of banking details there would be no online commerce. As Baroness Shields made clear in the House of Lords on 27 October 2015, the Government does not require the provision of a back-door key or support arbitrarily weakening the security of internet services.