Skip to content

Instantly share code, notes, and snippets.

View datt's full-sized avatar
🏠
Working from home

Dattatraya Dongare datt

🏠
Working from home
View GitHub Profile
@datt
datt / jwplayer5_ova_plugin.js
Last active December 19, 2015 22:39
Configuring the ova plugin for openx inline video ad serving.
/**There are two ways of configuring ads in OVA
i) By using zone id : */
jwplayer("videoContainer").setup({
modes:[{type: 'html5'},{type:'flash',src: "/jwplayer/player.swf"}],
autostart: 'true',
allowscriptaccess: 'always',
playlist: [
{
"provider": "rtmp"
@datt
datt / git.sh
Last active December 17, 2015 19:29
Useful git commands
######## 1.Create a branch without parent
# useful when scenario is: Suppose if you are on develop branch and you want to create a branch say feature having no code of develop branch. How can you do that?
git checkout --orphan feature
# this creates branch without parent, you can now pull remote feature into this branch.
######## 2. Add changes to previous commit or editing a git commit
# first add files you want to add in commit
git add . OR git add modified files
@datt
datt / ffmpeg.rb
Last active December 17, 2015 09:58
useful ffmpeg commands
#1. Getting resolution of video using ffmpeg
# after running following command you will get output in format 640x480
`ffmpeg -i #{path_to_video} 2>&1 | grep 'Video:' | cut -d \, -f 3 | sed -e 's/\[PAR//g' -e 's/x/:/g' | cut -d ' ' -f 2`
#2. Extracting preview(single) image for video
`ffmpeg -i #{path_to_video} -f image2 -ss 1 -vframes 1 #{path_to_video}/preview_0000.jpg`
#3. Extracting images from a video for a duration
`ffmpeg -i #{path_to_video} -r 25 -sameq -t #{duration} -s #{resolution} -vf -ss #{start_point} #{IMAGE_FILES_PATH}prefix_%d.jpeg`
@datt
datt / Gemfile
Last active December 17, 2015 09:49
Using Internationalization(I18n) in javascript of Rails application.
#NOTE Rails I18n translations on the Javascript.
gem 'i18n-js','2.1.2'
@datt
datt / ajax.js
Last active December 17, 2015 09:49
common function for sending an ajax request.
/**NOTE : Define, This method makes an ajax request*/
function sendAjaxRequest (options) {
var defaults;
defaults = {
dataType: "script",
requestType: "get",
data: {},
url: "/",
/**
* Read the JavaScript cookies tutorial at:
* http://www.netspade.com/articles/javascript/cookies.xml
*/
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
mysqldump --user=XXXXXXXX --password=XXXXXXX -A > /PATH/TO/DUMPFILE.SQL
mysql --verbose --user=XXXXXXXX --password=XXXXXXXX DB_NAME < /PATH/TO/DUMPFILE.SQL
// check flash support for visitor browser
function isFlashSupported() {
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(fo) hasFlash = true;
}catch(e){
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) {
hasFlash = true;
}
# change past commit's author email from 'vishal@blah.\(none\)' to '[email protected]'
git filter-branch --env-filter 'if [ $GIT_AUTHOR_EMAIL = vishal@blah.\(none\) ]; then [email protected]; fi; export GIT_AUTHOR_EMAIL'
# change past commit's author name from 'vishal' to 'Vishal Telangre'
git filter-branch --env-filter 'if [ $GIT_AUTHOR_NAME = vishal ]; then GIT_AUTHOR_EMAIL=Vishal\ Telangre; fi; export GIT_AUTHOR_NAME'
@datt
datt / mrdi.md
Created May 16, 2013 09:10 — forked from vparihar01/mrdi.md

Models, Roles, Decorators, and Interactions

A modest alternative to DCI that might be worth further thought

One of the problems with advancing the discussion on DCI is that we lack a comparable alternative pattern that has the same goals, but favors a low ceremony approach. The closest thing we have to that is Rails concerns, but they are more like distant relatives of the DCI concepts rather than first cousins, and that makes comparisions between the two approaches not especially fruitful.

I am considering the idea of experimenting with my own paradigm that captures the intent and purity of DCI, but with the convenience of concerns. Please note that this is just the starting point of a conversation, it is NOT a promise of comercially available cold fusion or a cure for cancer. It's just a gist with an idea on it I'd like to hear your thoughts on.

What if we had a top-level topology that was split into Models, **Rol