Skip to content

Instantly share code, notes, and snippets.

View nixsiow's full-sized avatar

Nix Siow nixsiow

View GitHub Profile
  1. update database YML file with

production: adapter: postgresql encoding: unicode database: whatsat_production pool: 5 password:

  1. remove unneeded gems

Grandma

Write a Deaf Grandma program.

Whatever you say to grandma (whatever you type in), she should respond with

HUH?! SPEAK UP, SONNY!

unless you shout it (type in all capitals).

npm install -g coffee-script //Globally install node package;
npm install coffee-script //Install locally in the folder; //Like locally installing a gem;
node node_modules/coffee-script/bin/coffee
node_modules/coffee-script/bin/coffee hello.coffee
//Need to compile to Javascript for the browser to read;
var DNAStringFactory = function(string){
var DNA = {
string: string,
count: function(letter){
if (!_.contains(['A', 'G', 'C', 'T', 'U'], letter)){
return alert('This is not valid!');
}
var result = _.filter(this.string, function(nucleotide){
return nucleotide == letter;
//nodejs.org
//CANARY is the next version of CHROME;
//CHROMIUM -> CANARY -> CHROME:
node //Type this into terminal;
//Node is now running on the server on ts own;
0.1 + 0.2
console.log('hi');
//It is so fast as it has not features out of the box;
//Bare bones, all driven by callBacks;Uses those same ideas over and over again;
def each(&block)
node = @head
while node
block.class(node.value)
end
end
#A minix a way of adding extra data to the class without having to use inheritance;
#You can only inherit from one class, a way to get around this is to created mixins;

Pling Plang Plong

Write a program that converts a number to a string per the following rules:

If the number contains 3 as a prime factor, output 'Pling'. If the number contains 5 as a prime factor, output 'Plang'. If the number contains 7 as a prime factor, output 'Plong'.

If the number does not contain 3, 5, or 7 as a prime factor, simply return the string representation of the number itself.

#Takes all commands written in text and converts into magic numbers, compiles into executable byte code which is Ruby specific;
#Converts english language into byte code, executes the byte code;
#The byte code is the sameo on every system (if you were running on mac or nintendo);
#To make it work it has to call the operating system;
#Opaerting system, library that knows how to open and close files, talk to the network, do mathemtatical stuff #When you intall operating system comes which a bunch of libraries;
#Ruby talks to the operating system which talks to the libraries;
#Underneath the operating system we have to BIOS (basic input output system). It knows how to talk with the hardward, what is the resolution of the screen, is a keyboard attached. The bios is read only;
#Underneath the bios was have the hardware. This is the horrible stuff to do with voltage etc.
$(document).ready(function(){
if(! window.DeviceOrientationEvent){
return;
}
$(window).on('deviceorientation', function(){
console.log('device-reorientated');
})
console.log('everything is fine');
});

Nucleotide Count

DNA is represented by an alphabet of the following symbols: 'A', 'C', 'G', and 'T'.

Each symbol represents a nucleotide, which is a fancy name for the particular molecules that happen to make up a large part of DNA.

Shortest intro to biochemistry EVAR:

  • twigs are to birds nests as
  • nucleotides are to DNA and RNA as