Skip to content

Instantly share code, notes, and snippets.

View aTei's full-sized avatar

Maksymenkov Eugene aTei

View GitHub Profile
@aTei
aTei / gist:4152631
Created November 27, 2012 06:01
MySQL search name duplicates
SELECT id, `videos`.name, episodes, logo FROM `videos`
INNER JOIN (SELECT name FROM `videos`
GROUP BY name HAVING count(id) > 1) `dup` ON `videos`.name = `dup`.name
ORDER BY `videos`.`name` DESC
SELECT `videos`.`name`, `videos`.`episodes`, `videos`.`is_ended`, `videos`.`id`, `videos`.`logo`, `videos`.`type`,
`user_videos`.`episode`, `user_videos`.`last_change`, `user_videos`.`status`,
`video_scores`.`score`,
( SELECT `video_names`.`name`
FROM `video_names`
WHERE (`video_names`.`lang` = 'ru' OR `video_names`.`lang` = 'en')
AND `video_names`.`vid_id` = `videos`.`id`
LIMIT 1) as alt_name
FROM (`videos`)
JOIN `user_videos` ON `user_videos`.`vid_id` = `videos`.`id`
@aTei
aTei / gist:4959242
Created February 15, 2013 08:56
Rails 3 basic auth (http authorization) before test
setup do
@request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("username:password")
end
@aTei
aTei / show_alts_spec.coffee
Last active December 18, 2015 23:59
BDD test secodary alts
describe 'Secondary alts', ->
loadFixtures('html/vid_alts')
$('.show-secondary').show_secondary()
hidden_alts = null
secondary_button = null
beforeEach ->
hidden_alts = $('.vid_view_alt_secondary')
secondary_button = $('.show-secondary')
@aTei
aTei / jquery_plugin_template.coffee
Last active December 19, 2015 02:28
jQuery plugin as CoffeeScript class template
class PluginClass
constructor: (@target) ->
_this = @ # to access Class inside @target.each and not modificate @ inside @target.each
eventData = {_class: _this} # to access Class inside event handlers
@target.each ->
self = $(@)
self.on 'click', eventData, _this.submitHandler
submitHandler: (e)->
_this = e.data._classs
e.preventDefault()
@aTei
aTei / example.html
Created June 28, 2013 09:16
div as p
<p>Bir əyləncə növü kimi peyntbol Azərbaycanda çoxdan mövcud olsa da, idman növü kimi bir müddət əvvəl inkişafa başlayıb.</p><div>
İyunun 30-da “Arena” idman peyntbolu klubunda (Paintball Club “Arena” - www.paintball-arena.az) gənclər arasında Azərbaycan Silahlı Qüvvələrinin 95-ci ildönümünə həsr olunmuş Çempionat keçiriləcək.</div>
<div>
&nbsp;</div>
<div>
<strong>Oxu.Az</strong> xəbər verir ki, turnirin əsas məqsədi yeni başlayan oyunçulardan ibarət yeni idman komandalarının yaradılması, sağlam həyat tərzinin təbliği və hərbi-vətənpərvərlik ruhunun yüksəldilməsidir. Bir əyləncə növü kimi peyntbol Azərbaycanda çoxdan mövcud olsa da, idman növü kimi bir müddət əvvəl inkişafa başlayıb.</div>
<div>
&nbsp;</div>
<div>
Çempionatın qaliblərindən başqa, digər iştirakçılar aşağıdakı nominasiyalarda mükafatlandırılacaqlar:</div>
@aTei
aTei / plain_paste.js
Created August 12, 2013 14:07
ContentEditable paste plain (require jQuery)
$(function(){
var interval;
$('body').on('paste', '[contenteditable]', function(e){
var self = $(this);
var current_html = self.html();
clearInterval(interval);
setTimeout(function(){
clearInterval(interval);
}, 1000);
@aTei
aTei / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aTei
aTei / python_resources.md
Last active August 29, 2015 14:15 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@aTei
aTei / css_resources.md
Last active August 29, 2015 14:15 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides