Skip to content

Instantly share code, notes, and snippets.

@ebello
ebello / toggle-visibility.js
Created May 22, 2020 15:55
Toggle Visibility React
/** @jsx jsx */
import { jsx } from 'theme-ui';
import React, { useState } from 'react';
import PropTypes from 'prop-types';
const ToggleVisibility = ({ trigger, children, initiallyVisible }) => {
const [isVisible, setIsVisible] = useState(initiallyVisible);
return (
<React.Fragment>
<span

Keybase proof

I hereby claim:

  • I am ebello on github.
  • I am ern (https://keybase.io/ern) on keybase.
  • I have a public key whose fingerprint is 4BD6 4F60 24EE CBA5 C81B 30DA 26A0 E6CF C65A 7DF5

To claim this, I am signing this object:

@ebello
ebello / gist:5170467
Created March 15, 2013 15:02
Dynamic extend-only selectors
@for $i from 0 through 6 {
%row#{$i} {
top: $block-size * $i;
}
}
@each $year in 1997, 1994, 1993, 1991 {
#y#{$year} a {
@extend %row3;
}
@ebello
ebello / command.rb
Created December 13, 2011 16:08
TextMate: Convert HTML document to Entities
#!/usr/bin/env ruby
$KCODE = 'U'
def encode (text)
text.gsub(/[^\x00-\x7F]|["'<>&]/) do |ch|
sprintf("&#%d;", ch.unpack("U")[0])
end
end
STDIN.read.scan(/(?x)
//dynamically generated by ASP.NET for the language passed in.
var labels = {
objectOverlay: {
closeX: 'Close X',
fallback: 'Video for {vid}'
},
global: {
label1: 'label1',
label2: 'label2'
}
@ebello
ebello / gist:330358
Created March 12, 2010 14:32 — forked from remy/gist:330318
Placeholder fixer
/**
* Add this script to the end of your document that use <input autofocus type="text" />
* or <input type="text" placeholder="username" /> and it'll plug support for browser
* without these attributes
* Minified version at the bottom
*/
(function () {
function each(list, fn) {
var l = list.length;
// bookmarklet to introspect the source of current page
javascript:(function(d,h){h=d.documentElement.innerHTML;d.open();d.write('<pre>'+('<!DOCTYPE html><html>'+h+'</html>').replace(/[<>]/g,function(m){return{'<':'&lt;','>':'&gt;'}[m]})+'</pre>')})(document);
' VB.Net 2.0
' a class for videos is what I was using my original code for
Public Class Video
Private _id As Integer
Public Property Id() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
public delegate T MethodExecution<T>(IDataReader reader);
public static List<T> LoadList<T>(IDataReader reader, MethodExecution<T> method)
{
return LoadList<T>(reader, true, method);
}
public static List<T> LoadList<T>(IDataReader reader, bool close_reader, MethodExecution<T> method)
{
List<T> list = new List<T>();
try
{
public static string ToIDList<T, U>(List<U> lookuplist) where U : ILookup<T> where T : struct
{
List<U> lookupidlist = lookuplist.FindAll(delegate(U lookup)
{
return lookup.ID.HasValue;
});
string idlist = String.Empty;
if (lookupidlist != null)
{
string[] ids = new string[lookupidlist.Count];