Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
echo "Enter m3u8 link:";
read link;
echo "Enter output filename:";
read filename;
ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 "$filename.mp4"
@richseviora
richseviora / cache_digest.rake
Created February 1, 2018 01:58
Rails Cache Digest Rake Task
namespace :cache_digests do
desc 'Resolves digest for file'
task :digest => :environment do
abort 'You must provide TEMPLATE for the task to run' unless ENV['TEMPLATE'].present?
template_name = CacheDigests.template_name
finder = CacheDigests.finder
puts "Finder Contents: #{finder.digest_cache.keys}"
tree = ActionView::Digestor.tree(template_name, finder, false)
puts "Locating Digest for '#{template_name}'"
digest = ActionView::Digestor.digest(name: template_name, finder: finder, dependencies: [])
@richseviora
richseviora / eslint-todo-gen.ts
Last active January 14, 2018 06:36
ESLint To-Do Autogenerator
import { CLIEngine, LintReport, LintResult, LintMessage } from "eslint";
import { relative } from "path";
import * as fs from "fs";
import * as YAML from "yamljs";
import * as _ from "underscore";
const newLint = new CLIEngine({
allowInlineConfig: false,
} as any);
@richseviora
richseviora / teriyaki_sauce.md
Last active January 11, 2018 21:11
Teriyaki Sauce Recipe

Ingredients

Base

  • 2 cup white sugar
  • 2 cup soy sauce
  • 1 cup cider vinegar
  • 4 clove garlic minced
  • 2 tsp. ground ginger
  • 1 tsp. black pepper

Thickening

  • 4 tbsp. cornstarch
@richseviora
richseviora / handler.tsx
Created October 5, 2017 02:56
Handler Allocation Examples
class ParentComponent extends React.Component<any, any>{
render(): JSX.Element {
return (
<div>
<EveryRenderComponent id={1} doTheThing={this.doTheNumberThing} />
<OnMountComponent id={2} doTheThing={this.doTheNumberThing} />
<OnParentComponent id={3} doTheThing={this.doTheDataSetThing} />
</div>
)
module ActionView
class Digestor
class << self
def tree(name, finder, partial = false, seen = {})
logical_name = name.gsub(%r|/_|, "/")
options = {}
options[:formats] = [finder.rendered_format] if finder.rendered_format
options[:formats].push(:html,:json) if finder.rendered_format == :js
if template = finder.disable_cache { finder.find_all(logical_name, [], partial, [], options).first }
@richseviora
richseviora / digestor_patch.rb
Created April 26, 2017 22:15
Patching ActionView::Digestor.tree to address cross-format dependency resolution.
module ActionView
class Digestor
class << self
def tree(name, finder, partial = false, seen = {})
logical_name = name.gsub(%r|/_|, "/")
options = {}
options[:formats] = [finder.rendered_format] if finder.rendered_format
options[:format].push(:html, :json) if finder.rendered_format == :js
@richseviora
richseviora / creamy_cheesecake.txt
Created April 9, 2017 17:47
Creamy Cheesecake Recipe
Ingredients
* Crust
* 1 1/4 cups graham cracker crumbs
* 1/4 cup white sugar
* 1 teaspoon ground cinnamon
* 1/3 cup butter, melted
* Sauce
* 20 oz packages pitted dark sweet cherries.
* 3 tbsp cornstarch
* 2 cup sugar.
@richseviora
richseviora / jest.test.ts
Created February 22, 2017 20:33
Twilio Example
namespace Twilio {
Device = {
setup: function () { },
ready: function () { },
offline: function () { },
incoming: function () { },
connect: function (params): Twilio.Connection { return null },
error: function () { }
}
}
@richseviora
richseviora / parsley.d.ts
Last active February 17, 2017 21:46
Working Parsley definition file
declare namespace parsley {
type RequirementValues = 'string' | 'integer' | 'number' | 'regexp' | 'boolean';
/**
* A ValidatorReturn should be one of the following:
*
* - True - is valid.
* - False - is not valid.
* - Error string or any other value - is not valid.
* - JQueryPromise returning one of the above.