Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/** * helpers.c * * Computer Science 50 * Problem Set 3 * * Helper functions for Problem Set 3. */
#include <cs50.h>
#include <math.h>
#include "helpers.h"
/** * Returns true if value is in array of n values, else false. */
bool search(int value, int array[], int n) {
// TODO: implement a searching algorithm
int high, low, i;
/**
* SOS.c by Iliyan Stankov
* Runs on TM4C123 LaunchPad
* Input from PF4(SW1),PF0(SW2), output to PF3 (Green LED)
* Pressing SW1 starts SOS (Green LED flashes SOS).
* Pressing SW2 stops SOS
*/
// Constant declarations to access port registers using
// symbolic names instead of addresses
loop A: loop over old_file_height // looping over each scan line in original file
loop B:
read each rgb-triple into an array // Read each pixel value in a complete scanline into an array
end loop B
skip over padding at end of scanline
loop C: loop n times // Set up a loop. loop resize times. Write the complete scan line n times.
loop D: loop trough pixel array // read each pixel from the array we just read.
Write pixel resize times.// Write the pixel out resize times.
end of loop D
write end of line padding // write new padding required for this scan line
<?php
// File name:- server_config.php
// Configuration settings for Mail server
define('SMTP_SERVER', 'smtp.gmail.com');
define('SMTP_PORT', 587);
define('SMTP_USERNAME', 'your_gmail_user_name');
define('SMTP_PASSWORD', 'your_gmail_password');
define('SMTP_AUTH', true);
define('SMTP_AUTH_TYPE', 'tls');
<?php
// Include PHPMailer library
require("PHPMailer/class.phpmailer.php");
// Include server settings
require("server_config.php");
// Create email object
$mail = new PHPMailer();
// Set email object options
/****************************************************************************
* odd_func.c
*
* Strange function definition test
*
* Can you define one function inside another and have it compile ?
* Apparently you can.
* We can have local functions.......
* Neither of these local function can be called from outside their scope.
*
@robsbots
robsbots / activity_main.xml
Created March 24, 2014 12:31
activity_main.xml The layout file from /res/layout/
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<uk.ac.reading.sis05kol.mooc.GameView
android:id="@+id/gamearea"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<RelativeLayout
@robsbots
robsbots / GameThread.java
Created March 24, 2014 12:23
GameThread as of week 5. Only one line needs chaning. This is for the soundpool setup
package uk.ac.reading.sis05kol.mooc;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.os.Bundle;
@robsbots
robsbots / TheGame.java
Last active August 29, 2015 13:57
Game file as of week 5. Sounds, lives, ball speed up on score
package uk.ac.reading.sis05kol.mooc;
//Other parts of the android libraries that we use
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.media.AudioManager;
import android.media.SoundPool;
package uk.ac.reading.sis05kol.mooc;
//Other parts of the android libraries that we use
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.media.MediaPlayer;
public class TheGame extends GameThread{
//Will store the image of a ball
private Bitmap mBall;
//The X and Y position of the ball on the screen (middle of ball)