Skip to content

Instantly share code, notes, and snippets.

View xullnn's full-sized avatar
🎯
Focusing

xullnn

🎯
Focusing
View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 4 columns, instead of 5. in line 1.
y,function,system,sub system
Chapter 1.2,1,1,1,0
Chapter 1.2.1,2,1,2,2
Chapter 1.2.2,1,0,0,0
@xullnn
xullnn / car_fitlering_app.js
Created December 22, 2019 08:14
Car Filtering App
var app = (function() {
var cars = [
{ make: 'Honda', image: 'images/honda-accord-2005.jpg', model: 'Accord', year: 2005, price: 7000 },
{ make: 'Honda', image: 'images/honda-accord-2008.jpg', model: 'Accord', year: 2008, price: 11000 },
{ make: 'Toyota', image: 'images/toyota-camry-2009.jpg', model: 'Camry', year: 2009, price: 12500 },
{ make: 'Toyota', image: 'images/toyota-corrolla-2016.jpg', model: 'Corolla', year: 2016, price: 15000 },
{ make: 'Suzuki', image: 'images/suzuki-swift-2014.jpg', model: 'Swift', year: 2014, price: 9000 },
{ make: 'Audi', image: 'images/audi-a4-2013.jpg', model: 'A4', year: 2013, price: 25000 },
{ make: 'Audi', image: 'images/audi-a4-2013.jpg', model: 'A4', year: 2013, price: 26000 },
];
@xullnn
xullnn / the_longest_sentence.js
Last active June 5, 2019 09:56
The longest sentence
var longText = 'Four score and seven years ago our fathers brought forth' +
' on this continent a new nation, conceived in liberty, and' +
' dedicated to the proposition that all men are created' +
' equal.' +
' Now we are engaged in a great civil war, testing whether' +
' that nation, or any nation so conceived and so dedicated,' +
' can long endure. We are met on a great battlefield of that' +
' war. We have come to dedicate a portion of that field, as' +
' a final resting place for those who here gave their lives' +
' that that nation might live. It is altogether fitting and' +
@xullnn
xullnn / rot13.js
Created May 5, 2019 09:51
Rot13 in Javascript
const LOWER_START = 97;
const UPPER_START = 65;
const LOWER_END = LOWER_START + 26;
const UPPER_END = UPPER_START + 26;
function newAsciiOf(char) {
var newAscii = char.charCodeAt() + 13;
if (/[a-z]/.test(char) && newAscii >= LOWER_END) {
newAscii = (LOWER_START + (newAscii % LOWER_END));
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
html {
font-size: 23px;
font-family: sans-serif;
font-weight: lighter;
@xullnn
xullnn / nutrition_facts.html
Last active April 17, 2019 12:30
practice html and css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
html {
font-size: 32px;
font-family: "Helvetica Black", Helvetica;
}
@xullnn
xullnn / halfway_in_ls.md
Created April 12, 2019 03:35
Halfway in LS

Halfway in my Launch School journey

I've just finished Database course in Launch School(hereinafter refer as LS), it's about half of its core curriculum. I prefer to call LS as a journey, because life in LS is more than what we do in a traditional "school".

Thanks to Internet

I live in a very small city in China, and I never knew or cared about anything about programming until 28. But thanks to Internet, I met LS. I was deeply drawn by LS's pedagogy. Instead of selling you the course urgently, LS provides a free preparatory course and advises you to make the decision after you've evaluated your feelings about the pre-course and you are agree with their pedagogy.

What I appreciate about LS

@xullnn
xullnn / update_yaml.rb
Created February 21, 2019 07:58
Try updating a portion of a yaml file
f = File.open("./example.yaml", "w")
100000.times do |n|
str = "user_#{n}:\n id: #{n}\n score: 0\n"
File.write("./example.yaml", str, mode: "a")
end
def find_position(target, file_obj)
file_obj.pos = file_obj.read =~ Regexp.new(target)
end
@xullnn
xullnn / decipher.rb
Last active January 15, 2019 07:29
zhuolaobanmimatiaozhan
encoded_text = <<-MSG
snmft
ltslcnsnonjhmzemjizfsbjsenijmfsdn
cnfrnfsbtdftonftljnsndnljwjsbz
emndtzsnbfshmjslqjemjljwjsbz
hfndtzonmznmztijonfsluns
efnrnrfczjpjhmjslemtsl
btrjshmzqjczjcnqjifqnfslonfrnmjonjrnijemnxmn
mfnqnftonjqjxmnljemzrnslijrnrfczjwjsbzyfrjsljozkjsllj
dtzcnjwjsxznwfsefteftonzvzxmnqjifsqnzcnfqjgftlznijxmzczjhmjsllzt
@xullnn
xullnn / mango_seller_with_comments.rb
Last active May 4, 2018 08:35
mango_seller_with_comments
class Person
attr_accessor :name, :is_seller, :friends
def initialize
@name = ('a'..'z').to_a.sample(5).join.capitalize!
@is_seller = false
@friends = []
end
end
def make_friends(n)