Skip to content

Instantly share code, notes, and snippets.

View pomahtuk's full-sized avatar

Ilia Loriakov pomahtuk

View GitHub Profile
@pomahtuk
pomahtuk / commandline
Last active July 15, 2016 08:16
django deploy setup
# server
# git repo itself
mkdir -p /var/git/yourapp.git
# where project will be
mkdir -p /var/www/yourapp
# make git server
cd /var/git/yourapp.git
git init --bare .
module.exports = (app) ->
# root namespace
app.namespace "/legacy/content_providers", ->
# content provider routes
app.get "/", contentProvider.list
app.get "/:id", contentProvider.show
app.post "/", contentProvider.create
app.put "/:id", contentProvider.update
app.delete "/:id", contentProvider.delete
app.get "/:id/objects", contentProvider.objects
upstream izi-cms3 {
server unix:/home/deployer/apps/izi-cms3/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server deferred;
server_name localhost;
root /home/deployer/apps/izi-cms3/current/public;
access_log /home/deployer/apps/izi-cms3/shared/logs combined;
# Main controller
angular.module("Museum.controllers").controller('routingController', [
'$q'
'$scope'
'$route'
'$routeParams'
'$rootScope'
'backendWrapper'
( $q, $scope, $route, $routeParams, $rootScope, backendWrapper ) ->
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
coffee:
options:
sourceMap: false
app:
expand: true
cwd: 'public/js/coffee/'
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
[[!FormIt? &hooks=`spam,email,redirect` &emailTpl=`MyEmailChunk` &emailTo=`atlant.vbg@gmail.com` &redirectTo=`1` &validate=`name:required, mail:email:required, phone:required, text:required:stripTags` ]]
<div class="section_header contacts">
<h3>Контакты</h3>
</div>
<p><strong>Адрес:</strong><br /> Лен обл. г. Выборг, Промзона Лазаревка<br /> Тел: +7 (921) 97-100-47,+7 (921) 76-766-47 <br /> e-mail: atlant.vbg@gmail.com </p>
<div class="right_float_cnt">
<strong>Режим работы:</strong><br /> Понедельник – пятница 08:00 - 19:00 <br /> Суббота 09:00 – 16:00 <br /> Воскресенье - выходной
</div>
<script charset="utf-8" type="text/javascript" src="http://api-maps.yandex.ru/services/constructor/1.0/js/?sid=nNWTtGSA3PgMOYWjJOzblbs6ftv3lFu2&amp;width=920&amp;height=350"></script>
<p> </p>
[[!FormIt?
&hooks=`spam,email,redirect`
&emailTpl=`MyEmailChunk`
&emailTo=`pman89@yandex.ru`
&redirectTo=`1`
&validate=`name:required,
mail:email:required,
phone:required,
text:required:stripTags`
]]
@pomahtuk
pomahtuk / gist:6247726
Created August 16, 2013 06:25
3. Допустим, параметры http-запроса хранятся как свойства объекта. Напишите функцию сериализации параметров в query-строку с добавлением к произвольному url.
var object_to_query = function(object) {
var key, result, value;
if (object == null) {
object = {
"route": "product/product",
"path": "59",
"product_id": "50"
};
}
result = window.location.href + '?';
@pomahtuk
pomahtuk / gist:6247686
Last active December 21, 2015 04:09
1. Напишите функцию разбора query-строки в набор параметров.
var query_to_object = function(url) {
var param, params, query, result, _i, _len;
if (url == null) {
url = 'http://moto1.englearn.org/index.php?route=product/product==&path=59&product_id=50';
}
query = url.split('?')[1];
result = {};
if (query != null) {
params = query.split('&');
for (_i = 0, _len = params.length; _i < _len; _i++) {