Skip to content

Instantly share code, notes, and snippets.

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

Reza reza-ryte-club

View GitHub Profile
View gist:a3d59b0a3f6c391b831e
#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;
View gist:c139aa7e2cdb3b84abb3
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--)
View gist:6a1241b1457cbd906436
//
// 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
View program.cs
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
View ViewController.m
//
// 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"
View sample.js
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 / Unique.java
Last active August 29, 2015 14:27
Check whether a string has uniqe characters
View Unique.java
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;
@reza-ryte-club
reza-ryte-club / StringReverse.java
Created August 22, 2015 07:23
Reverse A String
View StringReverse.java
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 / IsPermutation.java
Created August 22, 2015 07:41
Check whether a string is a permutation of another string
View IsPermutation.java
import java.util.Arrays;
public class IsPermutation {
public static boolean isPermutation(String str1, String str2){
if(str1.length() != str2.length()) return false;
char[] c1 = str1.toCharArray();
char[] c2 = str2.toCharArray();
Arrays.sort(c1);
Arrays.sort(c2);
@reza-ryte-club
reza-ryte-club / ReplaceCharacter.java
Created August 22, 2015 07:50
Replace a character with a string
View ReplaceCharacter.java
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);