Skip to content

Instantly share code, notes, and snippets.

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

<jaxcoder /> codenamejason

:octocat:
🫠
View GitHub Profile
function go() {
var userId = prompt('Username?', 'Guest');
var userData = { name: userId };
tryCreateUser(userId, userData);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userCreated(userId, success) {
if (!success) {
function go() {
var userId = prompt('Username?', 'Guest');
// Consider adding '/<unique id>' if you have multiple games.
var gameRef = new Firebase(GAME_LOCATION);
assignPlayerNumberAndPlayGame(userId, gameRef);
};
// The maximum number of players. If there are already
// NUM_PLAYERS assigned, users won't be able to join the game.
var NUM_PLAYERS = 4;
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) {
@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.
@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)
{
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):
// 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) {
@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()
/// <summary>
/// GetData - To get values
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public string GetData(int value)
{
if (value != null)
{
value = value * 10;
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]
}