Skip to content

Instantly share code, notes, and snippets.

View Dubiy's full-sized avatar
🔥
code everyday

Gary Dubiy

🔥
code everyday
View GitHub Profile
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView"
android:layout_gravity="center_horizontal" >
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@Dubiy
Dubiy / chat.js
Last active December 3, 2015 16:39
Node.js - socket.io websocket chat
'use strict';
const express = require('express'),
http = require('http'),
socketIo = require('socket.io'),
fetch = require('node-fetch'),
bodyParser = require('body-parser'),
dateFormat = require('dateformat');
const config = require('./config/config.json');
{
"server": "http://chat-backend.testserver.com"
}
var roomId = '95';
var apikey ='90d6bae946306d2dc3cd3c01b56889b8863495744bd3c4ab53adbb2cc546934f3482e1b7fa3ad24dc97842b07e0080aa3ad19fcb106b2f57719e8d9b76b139e7';
var socket = io('/chat');
$('form').submit(function(){
socket.emit('message', {
uuid: 'randomMsgUUID_' + parseInt(Math.random() * 1000000),
body: $('#message').val()
}, function(data) {
@Dubiy
Dubiy / chat-server.conf
Last active December 3, 2015 16:39
supervisord config example
[program:chat-server]
command=/usr/bin/node /home/ekreative/sites/chat-server/app/index.js
process_name=chat-server-%(process_num)s
numprocs=1
user=ekreative
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/chat-server-%(process_num)s.stdout.log
stdout_logfile_backups=3
stderr_logfile=/var/log/supervisor/chat-server-%(process_num)s.stderr.log
@Dubiy
Dubiy / chat-server.conf
Last active May 17, 2017 18:15
apache config for websocket
<VirtualHost *:80>
ServerName chat-backend.testserver.com
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/ [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://localhost:3001/$1 [P,L]
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
@Dubiy
Dubiy / Angular APP
Last active February 16, 2016 08:14
Angular demo app for symfony2 dashboard
angular.module('DemoEkBlog', [
'ui.bootstrap',
'ui.tinymce',
'angularModalService',
'ngFileUpload'
])
.controller('BaseCtrl', ['$rootScope', BaseCtrl])
;
function BaseCtrl($rootScope) {
@Dubiy
Dubiy / base.twig.html
Last active February 16, 2016 08:26
Symfony template
<!DOCTYPE html>
<html ng-app="DemoEkBlog">
<head>
<meta charset="UTF-8" />
<title>Demo eKreative Blog CP</title>
<link href="{{ asset('css/vendor.css') }}" media="all" rel="stylesheet" type="text/css" />
<link href="{{ asset('scss/dashboard.css') }}" media="all" rel="stylesheet" type="text/css" />
{% block stylesheets %}{% endblock %}
</head>
<body>
@Dubiy
Dubiy / form_override.html.twig
Created February 16, 2016 08:43
Symfony2 form override to work with AngulaJS
{%- block form_start -%}
{% set method = method|upper %}
{%- if method in ["GET", "POST"] -%}
{% set form_method = method %}
{%- else -%}
{% set form_method = "POST" %}
{%- endif -%}
<form name="{{ name }}" method="{{ form_method|lower }}" action="{{ action }}"{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}{% if multipart %} enctype="multipart/form-data"{% endif %}>
{%- if form_method != method -%}
@Dubiy
Dubiy / edit.html.twig
Last active February 16, 2016 10:31
example editor
{% extends 'AppBundle::baseDashboard.html.twig' %}
{% block body %}
<h1>Issue edit</h1>
<div class="issueEditor" ng-controller="IssueEditorCtrl" ng-init="init({{ initData|json_encode }})" ng-submit="">
<div class="row">
<form name="issueForm" class="render" ng-cloak novalidate>
<div class="issue_title">
<input ng-model="issue.title">