Skip to content

Instantly share code, notes, and snippets.

View duraz0rz's full-sized avatar
🖥️
Doing the thing

Marc Vertido duraz0rz

🖥️
Doing the thing
View GitHub Profile
public boolean has12(int[] nums) {
boolean has1 = false;
boolean has2 = false;
for (int i = 0 ; i < nums.length ; ++i) {
if (nums[i] == 1)
{
has1 = true ;
}
else if (has1 && nums[i] == 2)
{
@duraz0rz
duraz0rz / With_ORM.cs
Last active August 9, 2021 00:53
C# example with and without ORM
/*
Very simple example using LINQ to SQL and based on the MSDN LINQ to SQL page.
Make sure you include System.Data.Linq and System.Data.Linq.Mappings in your usings.
*/
// Table you want to associate with the entity
[Table(Name="Customer")]
public class Customer
{
// Columns in the database. Should have the same name between database and class variable
@duraz0rz
duraz0rz / modified_threading.cs
Created March 28, 2012 00:26
Modified Threading
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
@duraz0rz
duraz0rz / textcount_revised.c
Created March 14, 2012 03:15
revised edition of textcount.c
#include <stdio.h>
int main()
{
// Initialize to some arbitrary value so we avoid memory and comparison problems right off the bat
char currentChar = '\t';
int symbolCount = 0;
int numberCount = 0;
int firstTime = 1;