Skip to content

Instantly share code, notes, and snippets.

@realvjy
realvjy / ChoasLinesShader.metal
Last active October 23, 2024 20:57
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
//
// Config.swift
// Analytics
//
public protocol AnalyticsConfig {
static var analyticsKey: String { get }
static var appVersion: String { get }
}
function isChatMessage(message) {
if (message.__x_isSentByMe) {
return false;
}
if (message.__x_isNotification) {
return false;
}
if (!message.__x_isUserCreatedType) {
return false;
}
@sagaya
sagaya / luhn_algorithm.py
Created May 16, 2017 00:51
Luhn Algorithm for generating random valid credit card numbers with Python
import random
credit_card_number = ""
def make_random_number(number_of_element):
random_numbers = []
for i in range(number_of_element):
random_numbers.append(random.randint(0, 9))
return random_numbers
@sagaya
sagaya / luhn_algorithm.swift
Created May 15, 2017 23:39
Luhn Algorithm for generating random valid credit card numbers with swift
var card_number = ""
func make_random_number(num:Int)->[Int]{
var result = [Int]()
for _ in 0...num {
result.append(Int(arc4random_uniform(9)))
}
return result
}
func luhn_algorithm(){
@iamjason
iamjason / us-states-array
Created December 29, 2014 01:31
Swift US States Array
let state = [ "AK - Alaska",
"AL - Alabama",
"AR - Arkansas",
"AS - American Samoa",
"AZ - Arizona",
"CA - California",
"CO - Colorado",
"CT - Connecticut",
"DC - District of Columbia",
"DE - Delaware",
@mycodeschool
mycodeschool / Queue_CircularArrayImplementation.cpp
Last active May 25, 2024 10:46
Queue - Array Implementation
/* Queue - Circular Array implementation in C++*/
#include<iostream>
using namespace std;
#define MAX_SIZE 101 //maximum size of the array that will store Queue.
// Creating a class named Queue.
class Queue
{
private:
int A[MAX_SIZE];
@lukaskonarovsky
lukaskonarovsky / dynamicarray.cpp
Created April 6, 2009 21:33
C++ dynamic array implementation
#include "dynamicarray.h"
using namespace std;
DynamicArray::DynamicArray() {
DynamicArray::DynamicArray(5);
}
DynamicArray::DynamicArray(int initSize) {
size = initSize;