Skip to content

Instantly share code, notes, and snippets.

@enile8
enile8 / writing.c
Created January 8, 2013 03:23
Writing to file with C
#include <stdio.h>
int main()
{
char str [256];
puts("Enter some text you would like to add to the file:");
fgets(str,255,stdin);
FILE * pFile;
pFile = fopen("myfile.txt", "a");
if (pFile==NULL)
@enile8
enile8 / localtime.c
Created January 8, 2013 03:26
Display the current local time using C.
#include <stdio.h>
#include <time.h>
int main ()
{
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
@enile8
enile8 / classClass.cpp
Created February 5, 2013 02:35
A (crude) C++ example of using a class within a class.
#include <iostream>
#include <string>
using namespace std;
class alpha
{
public:
static string alphaFunc()
{
return "Greetings from the alpha class.\n";
@enile8
enile8 / recursionExample.cpp
Created March 20, 2013 20:24
Some in class recursion examples.
#include <iostream>
using namespace std;
int myFactorial(int integer)
{
if(integer == 1)
return 1;
else
{
return (integer * (myFactorial(integer-1)));
@enile8
enile8 / ArrayTest.java
Last active December 16, 2015 06:28
A 2d array example in Java.
public class ArrayTest {
public static void main(String[] args) {
final int ROW = 3;
final int COL = 4;
int[][] numbers = new int[ROW][COL];
int total = 0,
value = 0;
@enile8
enile8 / RecursionExample.java
Created April 20, 2013 14:14
A simple little recursion method example.
public class RecursionExample {
public static void main(String[] args) {
// call the method
int fact = myFactorial(3);
// print the result
System.out.println(fact);
}
public static int myFactorial(int integer) {
@enile8
enile8 / GCD.java
Created April 20, 2013 14:30
Greatest common divisor recursion example
public class GCD {
public static void main(String[] args) {
// jacked the test values from wikipedia
// output should be 37
System.out.println(gcd(259,111));
}
public static int gcd(int x, int y) {
if (y == 0)
return x;
@enile8
enile8 / db-test.php
Created June 30, 2013 06:19
A MySQL connection test script.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>MySQL Connection Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
#wrapper {
width: 600px;
margin: 20px auto 0;
@enile8
enile8 / bootstrap.flatten.css
Last active December 21, 2015 18:59 — forked from nodesocket/bootstrap.flatten.css
Added in .nav-pills
/* Flatten das boostrap */
.well, .navbar-inner, .nav-pills a, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
@enile8
enile8 / break_the_frame.js
Created May 26, 2017 11:35
break out of iframes
if(window.location != window.parent.location) {
window.parent.location = window.location;
}