Skip to content

Instantly share code, notes, and snippets.

View krlicmuhamed's full-sized avatar

Muhamed Krlić krlicmuhamed

  • IMASoft
  • Bosnia and Herzegovina
View GitHub Profile
@krlicmuhamed
krlicmuhamed / gogo6bosnian
Created September 13, 2014 12:12
gogo6 English to Bosnian translation.
---
English
---
If you are not already a member, please accept our upcoming invitation to join the Bosnia and Herzegovina country group in gogoNET.
Since we all share the same language, government and ISPs it makes sense to get together and share our IPv6 knowledge.
Please join our country group to interact with other IPv6 professionals in Bosnia and Herzegovina.
See you there!
---
// Can I do this?
//main.js
var m = require('./module');
var string = 'Hello from main!';
m.print();
//module.js
'use strict';
var pg = require('pg');
var db = 'notconn';
exports = module.exports = function(settings) {
db = new pg.Client(settings.database.connection.string);
db.connect(function(err, db, done) {
if(err) {
/*
// This is what I get while trying to communicate with my ESP8266 module
PORT OPEN 74880
Communication with MCU...
Got answer! AutoDetect firmware...
Can't autodetect firmware, because proper answer not received.

Communication with MCU...
"use strict";
module.exports = function(sequelize, DataTypes) {
var computers = sequelize.define("computers", {
domain: DataTypes.STRING
}, {
classMethods: {
exists: function(d){
return computers.count({where:{domain:d}}).then(function(count){
if(count>0){
return true;
@krlicmuhamed
krlicmuhamed / devise.ba.yml
Created May 4, 2015 17:00
Bosnian language for devise.
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
# Bosanski jezik.
ba:
devise:
confirmations:
confirmed: "Vaša email adresa je uspješno potvrđena."
send_instructions: "Primit će te email poruku sa instrukcijama za potvrdu vaše email adrese u nekoliko minuta."
send_paranoid_instructions: "Ako vaša email adresa postoji u našoj bazi, primit će te email sa instrukcijama za potvrdu vaše email adrese u nekoliko minuta."
failure:
#include <iostream>
using namespace std;
// Exercise 12-2: Design a structure to store time and date. Write a function to find the difference
// between two times in minutes.
struct datetime{
int seconds;
int minutes;
int hours;
<%= form_for @user_category do |f| %>
<p>
<%= f.label :description %>
<%= f.text_field :description %>
</p>
<p>
<%= f.radio_button :status, true, :id => 'status_true' %>
<%= f.label 'Ativo', :for => 'status_true' %>
@krlicmuhamed
krlicmuhamed / pgsql_function_example.sql
Created August 29, 2015 13:05
An example of postgres function ( stored procedure ) that returns a query.
CREATE OR REPLACE FUNCTION stored_get_data_history(SPGroupID integer, FromDate timestamp with time zone, ToDate timestamp with time zone)
RETURNS TABLE (device_id integer, "location" geometry, accuracy DOUBLE PRECISION, speed DOUBLE PRECISION, azimuth DOUBLE PRECISION, "createdAt" timestamp with time zone) LANGUAGE PLPGSQL AS $$
BEGIN
RETURN QUERY SELECT
"Data".device_id,
"Data".location,
"Data".accuracy,
"Data".speed,
"Data".azimuth,
"Data"."createdAt"
@krlicmuhamed
krlicmuhamed / request_html.js
Created October 3, 2015 10:42
Get HTML content from the internet
var s = require('net').Socket();
s.connect(80, 'google.com');
s.write('GET http://www.google.com/ HTTP/1.1\n\n');
s.on('data', function(d){
console.log(d.toString());
});
s.end();