Skip to content

Instantly share code, notes, and snippets.

View swdevbali's full-sized avatar
:octocat:
Bringing back my golden era of programming! Wohoo!

Eko Suprapto Wibowo swdevbali

:octocat:
Bringing back my golden era of programming! Wohoo!
View GitHub Profile
class HelloWorld{
public static void main(string arg){
System.out.println("Hello world!");
}
}
print 'Hello world'
@swdevbali
swdevbali / savejsoninredis.py
Created November 6, 2015 15:19
Simply json.dumps() => save to redis => redis.get => json.loads() => Python dict with proper data type created
__author__ = 'ekowibowo'
import json
import os
import redis
REDIS_HOST = os.getenv('SS_ABTEST_REDIS_HOST', '192.168.59.103')
r = redis.StrictRedis(host=REDIS_HOST)
for k in r.keys('abtest:experiments:*'):
r.delete(k)
@swdevbali
swdevbali / redisobject.py
Last active June 1, 2022 19:24
Redis store data as string, getting it back and trying to dump it as Json will still create json with string data type. We need to convert it back to correct data type using our own dict of types
__author__ = 'ekowibowo'
import os
import redis
from flask import jsonify, Flask
import json
REDIS_HOST = os.getenv('SS_ABTEST_REDIS_HOST', '192.168.59.103')
hkey = 'redisobject:whyweneedit'
r = redis.StrictRedis(host=REDIS_HOST)
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{$url->blogLink()}"><img class="img-responsive" src="{$url->getTemplateFile("img/pythonthusiast.png")}"></img></a>
</div>
{% macro render_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="form-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
Private Sub MainWindow_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Text = Application.ProductName & " version " & Application.ProductVersion
Config.init()
enterView(Pages.Item("home"))
End Sub