Skip to content

Instantly share code, notes, and snippets.

View vparihar01's full-sized avatar

Vivek Parihar vparihar01

View GitHub Profile
@vparihar01
vparihar01 / perfromance.txt
Created August 13, 2018 08:14
The Logic on performance of app
The Logic
In theory, you are correct. However, there are a few flaws with this rationale:
From what you stated, it's unclear if you actually tested / profiled your app. In other words, do you actually know that the network transfers from the app to the API are the slowest component? Because that is intuitive, it is easy to assume that it is. However, when discussing performance, you should never assume. At my employer, I am the performance lead. When I first joined, people kept talking about CDN's, replication, etc. based on intuition about what the bottlenecks must be. Turns out, our biggest performance problems were poorly performing database queries.
You are saying that because databases are good at retrieving data, that the database is necessarily running at peak performance, is being used optimally, and there is nothing that can be done to improve it. In other words, databases are designed to be fast, so I should never have to worry about it. Another dangerous line of thinking. That's like saying a ca
@vparihar01
vparihar01 / ffmpeg-cheatsheet.md
Created July 20, 2018 10:30 — forked from nickkraakman/ffmpeg-cheatsheet.md
FFmpeg cheat sheet for 360 video

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

 
FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

 
Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file
@vparihar01
vparihar01 / addEffect.swift
Created July 6, 2015 11:15
swift Blur, Vibrant and Vibrancy
// Blur Effect
var blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Dark)
var blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = view.bounds
view.addSubview(blurEffectView)
// Vibrancy Effect
var vibrancyEffect = UIVibrancyEffect(forBlurEffect: blurEffect)
var vibrancyEffectView = UIVisualEffectView(effect: vibrancyEffect)
vibrancyEffectView.frame = view.bounds
@vparihar01
vparihar01 / gist:dbeeb027537559051f92a2f27312701c
Created April 19, 2017 19:31
simply convert video files (i.e.: MKV to MP4)?
ffmpeg -i LostInTranslation.mkv -vcodec copy -acodec copy LostInTranslation.mp4
@vparihar01
vparihar01 / README.md
Last active November 11, 2016 15:09
Swift 2 + IOS >8.4 tips, tricks and code snippets for various UI's and functionality.

Swift 2 + IOS 8.4 & above Code Samples, tips, tricks for various UI customization

  • [UIViewExtension] - UIView extension for adding view border , corner radius , border color, border width and setting custom border like left,right,top and bottom borders from Storyboard.
  • [UILabelCustomize] - Add the shadow to UILabel. Customize the uilabel, to add the border with color, make it round and translate the inner text to right by X.
  • [UIColorHexToColor] - Convert the hex color into ios colors.
  • [UIbuttonExtension] - Text padding/inset from left to UIButton.
  • [buttonBorder] - IOS Add top , bottom, left and right button to button/text field.
  • [buttonPadding] - Add little text padding/inset from left
  • [StringExtension] - Truncate String in Swift
@vparihar01
vparihar01 / fetch_cbse_result.rb
Created April 1, 2014 08:44
this is small script will fecth the results of cbse 12th grade results.
require "uri"
require "net/http"
require "nokogiri"
require "logger"
name_final = Array.new
uri = URI.parse("http://resultsarchives.nic.in/cbseresults/cbseresults2004/class12/cbse12.asp")
req = Net::HTTP::Post.new(uri.path, {
'Referer' => "http://resultsarchives.nic.in/cbseresults/cbseresults2004/class12/cbse12.htm",
Access-Control-Allow-Headers
Access-Control-Allow-Methods
Access-Control-Allow-Origin
Access-Control-Max-Age
@vparihar01
vparihar01 / active_admin.rb
Created November 20, 2013 13:15
When downloading a csv of a model using active admin hat had around 24k records. But the csv was limited to only 10krows of data ,as it's hardcoded in active admin https://github.com/gregbell/active_admin/blob/master/lib/active_admin/resource_controller/data_access.rb#L276 . So if we try to download the CSV which have more then 12,000 records it…
# Monkey patch to increase the number of records
# exported in csv download -default is 10k
module ActiveAdmin
class ResourceController
module DataAccess
# in active admin 0.6
def max_csv_records
30_000
end
# needed for current active admin master
@vparihar01
vparihar01 / rmagick_solution.md
Created August 23, 2013 09:11
Solution for error installing Rmagick on Mountain Lion and after installation error in rmagick gem.

Error ->

dlopen(/Users/vivek/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib Referenced from: /usr/local/opt/imagemagick/lib/libMagickCore.5.dylib Reason: Incompatible library version: libMagickCore.5.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0 - /Users/vivek/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle

Step1 : Update XCode. Get the latest one Xcode 4.6 Mountain Lion does not come with ruby headers installed before hand, so you need to do this manually from XCode. Go to Xcode Preferences/Downloads.

Install Command Line Tools

<html>
<head>
<title>Geek Hours</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (Email - invoice notification.psd) -->
<table align="center" border="0" cellpadding="0" cellspacing="0" width="620" >
<tr>