Skip to content

Instantly share code, notes, and snippets.

@rukeba
rukeba / web.config
Last active August 29, 2015 13:57
Railo 4 Tomcat project powered by Helicon Zoo config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<clear />
<application name="railo.4.project">
<environmentVariables>
<add name="ERROR_LOG_DIR" value="%APPL_PHYSICAL_PATH%/logs" />
</environmentVariables>
</application>
[
{
"product": "Wordpress",
"parameters": {
"site-name": "wp4",
"app-pool-name": "DefaultAppPool",
"db-engine": "mysql",
"db-host": "localhost",
"db-port": "3306",
"db-username": "ывс",
@rukeba
rukeba / example_component.js
Created March 16, 2015 09:38
Example Component
jQuery(function ($) {
window.ExampleComponent = {
$placeholder: $('.js-component-placeholder'),
$item: $('.js-component-item'),
$btn_submit: $('.js-btn-component-submit'),
init: function () {
this.load_something();
function linkify(text){
return text.replace(/(https?:\/\/[\w\-:;?&=+.%#\/]+)/gi, '<a href="$1">$1</a>')
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
}
function prettyDate(time){
var date = new Date((time || "")),
diff = (((new Date()).getTime() - date.getTime()) / 1000),
day_diff = Math.floor(diff / 86400);
if (isNaN(date)){
return '';
}
return day_diff == 0 && (
@rukeba
rukeba / switch_python_version.py
Created January 27, 2011 07:53
Switch python version between multiple python installations
""" http://nedbatchelder.com/blog/200810/switching_python_versions_on_windows.html
Change the .py file extension to point to a different
Python installation.
"""
import _winreg as reg
import sys
pydir = sys.argv[1]
todo = [
@rukeba
rukeba / add_to_system_path.js
Created May 11, 2012 09:08
cscript: add path in system %PATH%, no reboot required
var shell = WScript.CreateObject('WScript.Shell');
var envs = shell.Environment('SYSTEM');
var systemPath = envs('PATH');
var paths = systemPath.split(';');
if (WScript.Arguments.Count() != 1){
WScript.StdErr.WriteLine('Error: one argument expected');
WScript.StdErr.WriteLine('Paths in %PATH% :');
for (i in paths){
WScript.StdOut.WriteLine(paths[i]);
@rukeba
rukeba / download.cmd
Created November 15, 2015 21:56
Download list of urls from text file
for /f %%i in (list.txt) do (
powershell.exe -Command "(new-object System.Net.WebClient).DownloadFile('%%i', '%%~nxi')"
)
@rukeba
rukeba / deploy.py
Created April 26, 2013 09:30
Templates for Django project with virtualenv & deploy powered by Helicon Zoo.
import sys
import os
import os.path
VIRTUALENV_EXE = os.path.join(os.path.dirname(sys.executable), 'scripts\\virtualenv.exe')
VIRTUALENV_NAME = 'venv'
DJANGO_PROJECT_NAME = 'project'
PROJECT_DIR = os.path.dirname(__file__)
@rukeba
rukeba / example.html
Last active December 16, 2015 20:49
Default project files for django-cms
{% load cms_tags sekizai_tags %}
<!doctype html>
<head>
<title>{{ request.current_page.get_title }}</title>
{% render_block "css" %}
</head>
<body>
{% cms_toolbar %}
{% placeholder "main" %}