Skip to content

Instantly share code, notes, and snippets.

@maxim75
maxim75 / gist:1224425
Created September 17, 2011 22:09
Sphinx search startup script for Ubuntu
#!/bin/bash
#
# Init file for searchd
#
# chkconfig: 2345 55 25
#
# description: searchd
#
# USE "chkconfig --add searchd" to configure Sphinx searchd service
#
@maxim75
maxim75 / gist:1221013
Created September 16, 2011 02:04
using deferreds in jQuery
function deferredTest(num, func)
{
var dfd = new $.Deferred();
console.log("deferredTest");
setTimeout(function() {
if(func(num))
{
console.log("resolve");
dfd.resolve( num );
}
@maxim75
maxim75 / init-deb.sh
Created July 9, 2011 23:48
Start script for nginx in ubuntu
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@maxim75
maxim75 / gist:1069068
Created July 7, 2011 07:59
Displaying GeoJSON data on Google Maps
<!DOCTYPE html>
<html>
<head>
<style>
#map_canvas {
width: 300px;
height: 300px;
}
</style>
@maxim75
maxim75 / gist:1064422
Created July 5, 2011 07:43
Bulk downloader for QR codes using Google Charts API
using System.Diagnostics;
using System.IO;
using System.Web;
namespace Qr
{
class Program
{
static void Main(string[] args)
{
@maxim75
maxim75 / gist:1050481
Created June 28, 2011 04:19
Plupload - handling POST request in ASP.NET
var chunk = Request.Form["chunk"] != null ? int.Parse(Request.Form["chunk"]) : 0;
var fileName = Request.Form["name"] ?? "";
//open a file, if our chunk is 1 or more, we should be appending to an existing file, otherwise create a new file
var fs = new FileStream(Server.MapPath("/files/" + fileName), chunk == 0 ? FileMode.OpenOrCreate : FileMode.Append);
//write our input stream to a buffer
var buffer = new Byte[Request.Files[0].InputStream.Length];
Request.Files[0].InputStream.Read(buffer, 0, buffer.Length);
@maxim75
maxim75 / gist:1044102
Created June 24, 2011 02:25
WP Links mapping
@s
.net .NET software development
chrome Google Chrome plugins
development Software development
ebook Ebook tools
editors Text editors
firefox Firefox plugins
graphics Graphic editiing and processing
Security Security
webtools Web based tools
@maxim75
maxim75 / gist:1037392
Created June 21, 2011 07:23
Accessing wikipedia api with JavaScript
<!DOCTYPE html>
<html>
<head>
<style>
</style>
<!-- JQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js">
</script>
@maxim75
maxim75 / gist:1026623
Created June 15, 2011 07:08
Create a Dynamic Scrolling Content Box Using AJAX
<!-- http://webdeveloperplus.com/jquery/create-a-dynamic-scrolling-content-box-using-ajax/#respond -->
<!DOCTYPE html>
<html>
<head>
<style>
#container{
width:400px;
@maxim75
maxim75 / jquery.validate.test.html
Created June 8, 2011 07:21
Using jquery.validate.js
<!DOCTYPE html>
<html>
<head>
<style>
.field
{
border: 1px solid #999;
}
label.error