Skip to content

Instantly share code, notes, and snippets.

@maxivak
maxivak / git_reset
Created December 24, 2013 14:45
git
# reset branch
git checkout production
git reset --hard origin/master
@maxivak
maxivak / git-hook-post-update
Created January 25, 2014 02:31
git examples
#!/bin/sh
echo
echo "**** get changes for TEST App"
echo
cd /var/www/html/testapp || exit
unset GIT_DIR
git pull origin master
@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 / 00.md
Last active June 29, 2023 06:02
Load 'seed' data in Rails - rake task. Details: http://maxivak.com/loading-seed-data-in-rails/

Rake task to load 'seed' data in Rails

@maxivak
maxivak / 00.md
Last active June 8, 2022 19:10
ActiveAdmin custom action

ActiveAdmin custom action

@maxivak
maxivak / 00.md
Last active December 10, 2023 14:50
Using RSpec without Rails

Using RSpec without Rails

@maxivak
maxivak / 00.md
Last active September 25, 2022 20:55
Selenium tests on Ruby

Selenium tests on Ruby

Install

gems:

  • gem 'capybara', '2.10.1'
  • gem 'selenium-webdriver', '3.0.3'

Selenium

@maxivak
maxivak / xvfb-init
Last active May 4, 2017 14:09
Xvfb init script
#!/bin/bash
# xvfb - this script starts and stops Xvfb
#
# chkconfig: 345 95 50
# description: Starts xvfb on display 99
# processname: Xvfb
# pidfile: /var/log/xvfb/xvfb.pid
# Source function library.