Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

arvi

🎯
Focusing
  • Laguna, Philippines
View GitHub Profile
@arvi
arvi / SimpleStore.js
Created Sep 8, 2016 — forked from ksafranski/SimpleStore.js
Simple localStorage function with Cookie fallback for older browsers.
View SimpleStore.js
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve:
@arvi
arvi / i18next-vanilla.js
Created Sep 6, 2016
jQuery's i18next counterpart on vanilla js
View i18next-vanilla.js
//translates text to user's preferred language
for (i = 0; i < document.querySelectorAll('[data-i18n]').length; i++) {
document.querySelectorAll('[data-i18n]')[i].innerHTML = i18next.t(document.querySelectorAll('[data-i18n]')[i].getAttribute("data-i18n"));
}
//source: https://github.com/i18next/i18next/issues/398#issuecomment-241671697
View framework7-messages-socketio.js
var myApp = new Framework7();
var $$ = Dom7;
// Conversation flag
var conversationStarted = false;
// Init Messages
var myMessages = myApp.messages('.messages', {
autoLayout: true
@arvi
arvi / client.js
Created Aug 30, 2016 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
View client.js
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});
View self-signed-cert.md
  • check if openssl is installed
which openssl
  • generate private key and certificate signing request
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048
openssl rsa -passin pass:x -in server.pass.key -out server.key
View framework7-messages.js
myApp.onPageInit('conversations-chat', function (page) {
var myMessages = myApp.messages('.messages', {
autoLayout: true //adds all required additional classes (like "message-pic", "message-with-avatar", "message-with-tail", etc)
});
//initialize message bar
var myMessagebar = myApp.messagebar('.messagebar');
var conversationStarted = false;
@arvi
arvi / sublime-ui-theme-font-face.js
Created Aug 5, 2016
Custom Sublime font face settings (tabs, labels, and sidebar)
View sublime-ui-theme-font-face.js
//------------------------------------------------------------------------------
// THEME FONT FACE
//------------------------------------------------------------------------------
//Tabs
{
"class": "tab_label",
"font.face" : ""
},
//Labels
@arvi
arvi / server.js
Last active Jul 20, 2016
Quick node server spin-up
View server.js
var fs = require("fs");
var host = "127.0.0.1";
var port = 3000;
var express = require("express");
var app = express();
app.use(express.static(__dirname + "/")); //use static files in ROOT/public folder
app.get("/", function(request, response){ //root dir
response.send("Hello There");
@arvi
arvi / kurento-cheatsheet.md
Last active Jul 11, 2016
Kurento Development Cheatsheet
View kurento-cheatsheet.md

Start / Stop

sudo service kurento-media-server-6.0 start
sudo service kurento-media-server-6.0 stop

Run NodeJs tutorial app:

View sublime-settings-user.json
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Agila Oceanic Next (SL).tmTheme",
"font_face": "Inconsolata",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],