Skip to content

Instantly share code, notes, and snippets.

@richseviora
richseviora / ExtendedTabbedPageRenderer.cs
Created May 9, 2016 17:52
Xamarin Forms - iOS TabbedPage Tab Font Overrides
using System;
using {AppName}.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using {AppName}.iOS.Views;
[assembly: ExportRenderer(typeof(TabbedPage), typeof(ExtendedTabbedPageRenderer))]
namespace {AppName}.iOS.Renderers
{
@richseviora
richseviora / AppPickerExtensions.cs
Last active July 29, 2020 14:38
Xamarin UI Test Date/Time Picker Extensions
// Tested with Xamarin.UITest V1.3.7;
using System;
using Xamarin.UITest;
namespace {APPNAMEHERE}.UITests
{
/// <summary>
/// This extension class extends the <see cref="IApp"/> interface to add extension methods for selecting values from the default Date/Time pickers in iOS and Android.
/// </summary>
public static class AppPickerExtensions
@richseviora
richseviora / override_driver.rb
Created December 15, 2016 22:26
Capybara/Selenium Fix for Rubymine Debugging w/ Ruby 2.3+
# This OverrideDriver class is used to override the +open_timeout+ property Selenium's default HTTP driver.
# This is necessary to support debugging in Rubymine because when the process is stopped on the breakpoint,
# any new threads are not scheduled.
# This is an issue in Ruby 2.3+ because the Net::HTTP#initialize method now defaults the open_timeout property
# to 60 (seconds), as opposed to 0 previously. A non-zero/nil value executes the connection in a new thread
# (see +Net::HTTP#connect+).
# === Change Notes
#
# * Setting timeout directly does not work, the read_timeout period needs to remain at its current setting.
# A setting of 0 prevented pages from opening successfully.
#!/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