Skip to content

Instantly share code, notes, and snippets.

View codenamejason's full-sized avatar
:octocat:
🫠

<jaxcoder /> codenamejason

:octocat:
🫠
View GitHub Profile
// Get selected element
var s = document.getElementById('MySelect');
// Index to add the option
var i = 0;
// New option('text', 'value')
s.options[i++] = new Option('text', 'value');
s.options[i++] = new Option('Vermont', 'VT');
// Set a selected index
s.selectedIndex = 1;
// Or
@codenamejason
codenamejason / 01-directory-structure.md
Created June 7, 2016 19:13 — forked from tkissing/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
var array1 = [1,2,3];
var array2 = [4,5,6];
window.onload = function() {
array1 = array1.concat(array2);
// result = array1[1,2,3,4,5,6]
}
/// <summary>
/// GetData - To get values
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public string GetData(int value)
{
if (value != null)
{
value = value * 10;
@codenamejason
codenamejason / MasterDetail.cs
Last active December 11, 2015 03:21
XAML for a content page
using System;
using Xamarin.Forms;
namespace XamarinFormsTestHarness
{
public class MasterDetailControlPage : MasterDetailPage
{
public MasterDetailControlPage()
// Define variables to access each service. Note the usage of
// node.js modules via the "require(...)" calls.
var services = {
countries: require("./countries_service"),
regions: require("./regions_service"),
cities: require("./cities_service")
}
function sendResults(res, params, status, statusText, headers, result) {
import pytest
from sow_web_codegen.reader.xlsx import XlsxReader
from sow_web_codegen.reader.xlsx import XlsxReaderInvalidFileFormatException
from tests import EXAMPLE_WORKSHEET_XLSX as example_worksheet
def gen_get_value_func(columns, row):
def get_column(column):
@codenamejason
codenamejason / RandomOAuthStateGen.cs
Last active August 29, 2015 14:25
RandomOAuthStateGen
private static class RandomOAuthStateGenerator
{
private static RandomNumberGenerator _random = new RNGCryptoServiceProvider();
public static string Generate(int strengthInBits)
{
const int bitsPerByte = 8;
if (strengthInBits % bitsPerByte != 0)
{
@codenamejason
codenamejason / linq.cs
Last active August 29, 2015 14:19
LINQ Class in C#
// 04/19/2015
// Jason Romero | Codenamejason
//
//
class IntroToLINQ
{
static void Main()
{
// The Three Parts of a LINQ Query:
// 1. Data source.
function getParent(snapshot) {
// You can get the reference (A Firebase object) from a snapshot
// using .ref().
var ref = snapshot.ref();
// Now simply find the parent and return the name.
return ref.parent().name();
}
var testRef = new Firebase("https://example.firebaseIO-demo.com/foo/bar");
testRef.once("value", function(snapshot) {