Skip to content

Instantly share code, notes, and snippets.

@ivan-hilckov
ivan-hilckov / gist:3177393
Created July 25, 2012 17:25 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@ivan-hilckov
ivan-hilckov / Quadratic equation Java
Created November 13, 2012 10:30 — forked from glamkawaii/Quadratic equation Java
Quadratic equation in Java
package edu.workspace;
import java.util;
import java.io.InputStream;
class SquareEquation {
    public static void findSquareEquationRoots(String[] args) {
        print("Решим квадратное уравнение");
        if (args.length < 3) {
            println("Введите параметры уравнения(a, b, c) в командной строке");
@ivan-hilckov
ivan-hilckov / beeper.js
Created November 30, 2012 20:35 — forked from pmuellr/beeper.js
beep() and boop() with HTML5 Audio
//-----------------------------------------------------------------------------
// The MIT License
//
// Copyright (c) 2009 Patrick Mueller
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.
var map = L.map( 'map' );
L.Map.prototype.panToOffset = function (latlng, offset, options) {
var x = this.latLngToContainerPoint(latlng).x - offset[0]
var y = this.latLngToContainerPoint(latlng).y - offset[1]
var point = this.containerPointToLatLng([x, y])
return this.setView(point, this._zoom, { pan: options })
}
function centerMap(){

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
{% load base_tags %}
<div id="links" class="links">
<form action="{% url 'answer-samootvod' %}" method="post">
{% csrf_token %}
<input type="submit" class="btn btn-sm btn-default btn" value="Отказаться от олимпиады" />
</form>
# -*- coding: utf-8 -*-
"""Port of slipsum.js from http://slipsum.com/"""
import random
ipsum = [
"Normally, both your asses would be dead as fucking fried chicken, but you happen to pull this shit while I'm in a transitional period so I don't wanna kill you, I wanna help you. But I can't give you this case, it don't belong to me. Besides, I've already been through too much shit this morning over this case to hand it over to your dumb ass.",
"Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows. Some pilots get picked and become television programs. Some don't, become nothing. She starred in one of the ones that became nothing.",
(function(){Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(ele){ele.style.background = 'rgba(0, 129, 255, 0.05)'})})();
@ivan-hilckov
ivan-hilckov / nl.sh
Created June 27, 2016 11:23 — forked from yyx990803/nl.sh
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"