This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**NOTE : Define, This method makes an ajax request*/ | |
| function sendAjaxRequest (options) { | |
| var defaults; | |
| defaults = { | |
| dataType: "script", | |
| requestType: "get", | |
| data: {}, | |
| url: "/", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #NOTE Rails I18n translations on the Javascript. | |
| gem 'i18n-js','2.1.2' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ######## 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BaseCreator < Creators::Base | |
| EXTRA_PARAMS = [:action, :controller, :format,:utf8,:authenticity_token] | |
| def initialize(raw_params, model) | |
| super(raw_params,model) | |
| end | |
| def refine_params | |
| @params.deep_symbolize_keys.delete_if{|k,v| EXTRA_PARAMS.include? k } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function displayVideo(elementID, options) { | |
| var defaults; | |
| defaults = { | |
| height: 347, | |
| width: 624, | |
| swfPath: '/jwplayer/jwplayer.flash.swf', | |
| controls: false, | |
| autostart: true | |
| }; | |
| var settings = $.extend({}, defaults, options); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #resetting the password of postgresql | |
| sudo -u postgres psql postgres | |
| postgres=# \password postgres | |
| # restoring postgres dump database | |
| pg_restore -c -i -U postgres -h localhost -d database_name -v "dump_file" -W | |
| pg_restore --verbose --host localhost --username postgres --clean --no-owner --no-acl --dbname database_name dump_file.dump | |
| # for mac: full path is required. | |
| Applications/Postgres.app/Contents/Versions/9.4/bin/pg_restore -c -i -U postgres -h localhost -d database_name -v "dump_file" -W |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| end |