Skip to content

Instantly share code, notes, and snippets.

View bekatom's full-sized avatar
🎯
Focusing

Beka Tomashvili bekatom

🎯
Focusing
View GitHub Profile
@bekatom
bekatom / gist:b1805034a5ae965c749f
Created September 7, 2014 10:27
To fix utf problems in python
import sys
reload(sys)
sys.setdefaultencoding("utf8")
@bekatom
bekatom / url.py
Last active August 29, 2015 14:08
Vobi API get store list by company identification JQUERY AND DJANGO
$(document).ready(function() {
// GETS Store list by compnay identification
$.get("/get-store-list/" + $("#company-identity").val() ,
function (data) {
var result = data.Result;
$.each(result, function(i, item) {
$('#sales-store-list').append($('<option></option>').val(result[i].Id).html(result[i].Name));
@bekatom
bekatom / datatime.js
Created October 27, 2014 11:59
Working With Datetimes Javascript
// Get first Date and Last Date of Current month
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
alert(firstDay.toLocaleString()); // 10/1/2014, 12:00:00 AM
alert(lastDay.toLocaleString()); // 10/31/2014, 12:00:00 AM
@bekatom
bekatom / django_json.py
Last active August 29, 2015 14:09
django object to json
from django.core import serializers
def tst (request):
test = Tourist.objects.all()
data = serializers.serialize("json", test)
return HttpResponse(data)
@bekatom
bekatom / ajax_and_django.js
Last active August 29, 2015 14:10
django & JS client >json
function get_hotel_price(id){
$.ajax({
data : { 'id' : id},
type : 'GET',
url : '/hotels/price/',
success : function(responce){
rs = JSON.parse(responce);
$('#id_price').val(rs.price);
}
@bekatom
bekatom / rs.py
Last active August 29, 2015 14:10
RS.ge
# -*- coding: utf-8 -*-
__author__ = 'Beka Tomashvili'
from suds.client import Client
import json
rs_url = "https://services.rs.ge/WayBillService/WayBillService.asmx?WSDL"
user = 'vobi:12345678910'
password = 'vobi1234'
@bekatom
bekatom / nbg_functions.py
Last active August 29, 2015 14:10
NBG.ge
# -*- coding: utf-8 -*-
__author__ = 'Beka Tomashvili'
from suds.client import Client
nbg_url = "http://nbg.gov.ge/currency.wsdl"
def get_currency_description(curr):
client = Client(nbg_url)
@bekatom
bekatom / link_replace.js
Last active August 29, 2015 14:13
replace links
@bekatom
bekatom / www_node.js
Created May 6, 2015 20:53
https_config_express_js
#!/usr/bin/env node
var debug = require('debug')('invoice');
var app = require('../app');
var path = require('path');
var fs = require('fs');
var https = require('https');
var http = require('http');
var key = fs.readFileSync('/etc/ssl/private/server.key');
@bekatom
bekatom / gulpfile.js
Last active October 19, 2018 13:26
Minify javascript and Css with gulp
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
gulp.task('js', function() {
return gulp.src('public/javascripts/*.js')
.pipe(uglify())
.pipe(gulp.dest('public/javascripts/min'));
});