Skip to content

Instantly share code, notes, and snippets.

View reza-ryte-club's full-sized avatar

Reza reza-ryte-club

View GitHub Profile
#import "FirstViewController.h"
#import "AppDelegate.h"
#import "Tasks.h"
#import "SimpleTableCell.h"
@interface FirstViewController ()
@property (retain,nonatomic) NSMutableArray *tasklist;
@property (retain,nonatomic) NSMutableArray *courselist;
@property (retain,nonatomic) NSMutableArray *teacherlist;
@property (retain,nonatomic) NSMutableArray *datelist;
function checkIfPrime(number){
for( something = 2; something <= Math.sqrt(number); something++)
if( number % something == 0) return 0;
return 1;
}
function findPrimeFactors(number) {
//find prime numbers less than the number
for( i = Math.floor(number/2); i >=2 ; i--)
//
// ViewController.m
// logintest
//
//
#import "ViewController.h"
#import "AFNetworking.h"
@interface ViewController ()
@reza-ryte-club
reza-ryte-club / program.cs
Last active August 29, 2015 14:21
Xamarin Implementation of POST request
using System;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace Aduuu
{
@reza-ryte-club
reza-ryte-club / ViewController.m
Created May 16, 2015 04:29
AFNetworking implementation for Cocoa Touch
//
// ViewController.m
// logintest
//
// Created by AGD IT on 5/13/15.
// Copyright (c) 2015 AGD IT. All rights reserved.
//
#import "ViewController.h"
#import "AFNetworking.h"
var fs = require ('fs');
fs.readdir(__dirname, function (err, files) {
console.log(files);
});
// function readLines(input, func) {
// var remaining = '';
@reza-ryte-club
reza-ryte-club / StringReverse.java
Created August 22, 2015 07:23
Reverse A String
public class StringReverse {
public static String reverseString(String str){
StringBuilder dest = new StringBuilder(str.length());
for(int i = str.length()-1;i>=0;i--){
dest.append(str.charAt(i));
}
return dest.toString();
}
@reza-ryte-club
reza-ryte-club / Compress.java
Created August 22, 2015 09:34
Compress consecutive character occurrence of a character in a String
public class Compress {
public static String compressedString(String str){
StringBuilder dest = new StringBuilder();
for(int i=0;i<str.length();i++){
char c = str.charAt(i);
dest.append(c);
int j = i;
@reza-ryte-club
reza-ryte-club / ReplaceCharacter.java
Created August 22, 2015 07:50
Replace a character with a string
public class ReplaceCharacter {
public static String stringReplacer(String str,char source,String replaced){
StringBuilder dest = new StringBuilder();
for(int i = 0;i<str.length();i++){
char ch = str.charAt(i);
if(ch==source){
dest.append(replaced);
@reza-ryte-club
reza-ryte-club / Unique.java
Last active August 29, 2015 14:27
Check whether a string has uniqe characters
package com.company;
public class Unique {
public static boolean checkUnique(String word){
if(word.length()>256) return false;// if a string is more than 256 characters long, it repeats any of the string
boolean[] charset = new boolean[256];
for(int i = 0;i<word.length();i++){
char c = word.charAt(i);
if(charset[c]) return false;
charset[c]=true;