Skip to content

Instantly share code, notes, and snippets.

@begedin
begedin / GridView.css
Last active January 30, 2024 17:25
Styling for an ASP.NET GridView
.myGridClass {
width: 100%;
/*this will be the color of the odd row*/
background-color: #fff;
margin: 5px 0 10px 0;
border: solid 1px #525252;
border-collapse:collapse;
}
/*data elements*/
@begedin
begedin / ajvar.md
Created January 15, 2024 21:03
Ajvar

Ingredients

  • 5kg of red horn pepper. green works to, but it's gonna look weird
  • 3kg of egg plant, classic purple kind
    • you can vary this a bit, but usually the ration is 1:2 to 3:5
  • 1 entire head of garlic
  • 0.5 liter of vegetable, rapeseed or sunflower oil. basically any that doesn't have a strung flavor and has a high heat resistance
  • chilli peppers to taste
  • various spices to taste listed below
  • sugar

Including the library

Sadly, elements is not a separate library.

It's just a part of the still in development Stripe.js v3, so the only way to include it is to include the whole script in the page somewhere. There is no bower library, no amd/require/commonjs package of any sort.

This is the only way to include it:

@begedin
begedin / ko.scrollTo.js
Created May 8, 2014 06:12
ScrollTo binding for knockout
// usage: data-bind="scrollTo: booleanObservable"
// will scroll to this item if observable is true
// made by eselk of stack excahnge: http://stackoverflow.com/users/1042232/eselk
// found in thread: http://stackoverflow.com/questions/10126812/knockout-js-get-dom-object-associated-with-data
ko.bindingHandlers.scrollTo = {
update: function (element, valueAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
console.log(value);
if (value) {
var scrollParent = $(element).closest("div");
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(
string lpClassName,string lpWindowName);
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

Note: Once you read through this, I recommend at some point watching a video on Vimeo which really helped me

What are components all about.

The general idea behind it is the same one we have behind a web component in general. Right now, in HTML, we have elements. Each element has some sort of behavior and meaning behind it. <p> is a paragraph, <h1> is a header, and they are both meant to work as such. There isn't a lot of behavior tied to thise, but there is to some of the more advanced elements such as <input>, <audio> or <video>.

Components are intended to be something like a new custom HTML element, albeit we use it in our templates, not actual HTML. Still, ti's supposed to be something that encapsulates behavior and presentation of a single UI element, meant to be used for a specific purpose. In this analogy

  • the data we bound to a componet woul
@begedin
begedin / TouchYCoordinate
Created November 21, 2013 21:06
Shift the y coordinate of the touch position to work from bottom instead of top.
Vector2 touchPos = new Vector2(Gdx.input.getX(), camera.viewportHeight - Gdx.input.getY());
@begedin
begedin / Camera
Last active December 29, 2015 00:59
How to set LibGDX Orthographic Camera to start at bottom left.
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
newValue = easeFunction(
elapsedTime,
initialValue,
totalChange,
totalDuration
);
@begedin
begedin / Lambda.cs
Created May 15, 2013 11:28
This is Lambda
x => x.Name == "Bob"