Skip to content

Instantly share code, notes, and snippets.

View Teino1978-Corp's full-sized avatar

Teino Boswell Teino1978-Corp

  • Ocho Rios, Jamaica
View GitHub Profile
@Teino1978-Corp
Teino1978-Corp / to_international.rb
Created November 22, 2015 07:55
To_international_phone
# The following is a challenge in Ruby which I thought would be quite easy, but... isn't.
# So the issue is user #1 (identified by his international phone number) invites his friend user #2 by SMS and tells us he invited his friend. Because the invititation is by SMS, the number might be local and might be international. Your challenge, should you choose to accept it, is to convert user #2's number to an international format, as follows:
# If user #2's number is already international, save it as is. If not, take user #1's country code (as parsed from his international number) and add that country code to user #2's number. (Take note adding a country-code is non-trivial; e.g. in Israel you remove the first '0' to do this properly, while in the US you don't.)
# You may use any external (Ruby) libs or gems for this.
x = 3.14; // This will not cause an error.
myFunction();
function myFunction() {
"use strict";
y = 3.14; // This will cause an error (y is not defined)
}
@Teino1978-Corp
Teino1978-Corp / README.md
Last active November 22, 2015 06:59
Force layout showing fully connected mesh network topology

Force layout showing fully connected mesh network topology.

@Teino1978-Corp
Teino1978-Corp / electrical5.csv
Created November 21, 2015 20:09
D3.js Zoomable Sunburst visualization from self-referencing CSV input. See index.html
id parentId name size department totalorextract total pages
ROOT NULL Pune Budget - Electricity Related Pune Budget - Electricity Related E 3060146700
RE ROOT General > Revenue Expenditure General > Revenue Expenditure E 945808250
CE ROOT General > Capital Expenditure General > Capital Expenditure E 968020000
XE ROOT Water > Revenue Expenditure Water > Revenue Expenditure E 1017366450
ZE ROOT Water > Capital Expenditure Water > Capital Expenditure E 112552000
FE ROOT Khas_ Upanagare Vikas Nidhis Khas_ Upanagare Vikas Nidhis E 16400000
RE_Other RE RE_Other Revenue Expenditure E 248362250
CE_Other CE CE_Other Capital Expenditures E 106960000
RE11 RE_Other Main supervision_ recovery etc. Revenue Expenditure E 20910000
@Teino1978-Corp
Teino1978-Corp / t.js
Created November 21, 2015 19:03
yui timer core api
YUI({ filter: "raw" }).use('node', 'router', 'app', 'model', 'view', 'plugin', 'console', 'parallel',function (Y) {
// This AnchorPlugin is designed to be added to Node instances (the host will be a Node instance)
var ctxConsole = new Y.Console({
logSource: Y.Global,
style: 'block',
newestOnTop: false,
width: "250px"
}).render("#Debug");
.
├── bookstore-0.0.1-SNAPSHOT
│ ├── META-INF
│ ├── WEB-INF
│ │ ├── classes
│ │ │ ├── banner.txt
│ │ │ ├── com
│ │ │ │ └── mycompany
│ │ │ │ └── myapp
│ │ │ │ ├── Application.class
<?xml version="1.0" encoding="UTF-8"?>
<computerstore>
<catalogcomputers id="1">
<computer id="1">
<title>Computer1</title>
<type>Desktop</type>
<amount>10</amount>
</computer>
<computer id="2">
<title>Computer2</title>

Add ssh key to host in two line

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'
<html>
<head>
<title>Simple Node JS and Socket IO Chat</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:5432');
// add a new chat message
socket.on('add_message', function (name, data) {