Skip to content

Instantly share code, notes, and snippets.

@maxivak
maxivak / css-ul-div-align
Last active August 29, 2015 13:56
CSS examples
/*
center align ul inside DIV
*/
<div id="menu">
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
@maxivak
maxivak / js-css-change-style
Created February 21, 2014 11:44
JS simple
document.getElementById("MyElement").className = " MyClass";
// To add a class to an element:
document.getElementById("MyElement").className += " MyClass";
// To remove a class from an element:
document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','')
@maxivak
maxivak / php-image-corrupted
Created May 14, 2014 11:20
PHP. Check if image is corrupted
$filaname = 'file.jpg';
if (!@imagecreatefromjpeg($filename)){
echo "bad image";
}
else{
echo 'ok';
}
@maxivak
maxivak / javascript_resources.md
Last active August 29, 2015 14:09 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@maxivak
maxivak / rails_resources.md
Last active August 29, 2015 14:09 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@maxivak
maxivak / 0_reuse_code.js
Last active August 29, 2015 14:09
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
@maxivak
maxivak / rails_haml_examples.md
Last active August 29, 2015 14:11
Rails HAML Examples

HAML Examples

Append class if condition is true in Haml

.class1{:class => ("gray" unless post.published?)}
%div{class: ["class1", ("gray" unless post.published?)]}

%div{class: post.published? && 'gray' }

@maxivak
maxivak / __contents.md
Last active August 29, 2015 14:11
simple_form and bootstrap 3 examples

simple_form and bootstrap 3 - Examples

  • Helper for horizontal form
  • Input groups
  • Custom submit button
@maxivak
maxivak / readme.md
Last active August 29, 2015 14:21
Install Ruby 2.1.x on Windows
@maxivak
maxivak / 00_readme.md
Last active August 29, 2015 14:25
New Rails app in Nginx+Passenger

New Rails app in Nginx with Passenger

This gist shows how to setup and configure Rails application in Nginx on Centos.

Our application will be located in '/var/www/apps/mysite'.

Passenger

After installing Passenger Nginx will be located in '/opt/nginx' directory.