Skip to content

Instantly share code, notes, and snippets.

View P1xt's full-sized avatar
🏠
Working from home

P1xt P1xt

🏠
Working from home
  • Freelance
  • Minneapolis, MN, USA
View GitHub Profile
@P1xt
P1xt / gist:8965731
Created February 12, 2014 22:20 — forked from mstssk/gist:4234745
@P1xt
P1xt / test
Created August 5, 2014 05:01
Testing Python gist
import math
ceil(84.2)
grade_report(80)
def grade_report(grade):
if grade >= 80:
return 'excellent'
elif grade >= 50:
return 'pass'
@P1xt
P1xt / Reverse Groups
Created August 5, 2014 08:50
Reverse Groups
var fs = require("fs");
fs.readFileSync(process.argv[2]).toString().split('\n').forEach(function (line) {
if (line != "") {
var parsedLine = line.split(";");
var k = parsedLine[1];
var digits = parsedLine[0].split(",");
var length = digits.length;
if (k > 1) {
for (var i = 1; i <= length; i++) {
if (i % (k) === 0) {
@P1xt
P1xt / Prime Palindrome Javascript
Created August 5, 2014 08:57
Prime Palindrome
var highEnd = 1000;
var primes = sieve(highEnd);
highEnd--;
var found = false;
while (found == false ) {
if (isPalindrome(highEnd.toString()) == true) {
if (primes[highEnd] == true) {
found = true;
}
}
@P1xt
P1xt / Prime Palindrome
Created August 5, 2014 08:58
Prime Palindrome
var highEnd = 1000;
var primes = sieve(highEnd);
highEnd--;
var found = false;
while (found == false ) {
if (isPalindrome(highEnd.toString()) == true) {
if (primes[highEnd] == true) {
found = true;
}
}
@P1xt
P1xt / Prime Palindrome
Created August 5, 2014 09:00
Prime Palindrome
<?php
/**
* Write a program to determine the biggest prime palindrome under 1000.
INPUT SAMPLE:
There is no input for this program.
OUTPUT SAMPLE:
Your program should print the largest palindrome on stdout, i.e.
929
@P1xt
P1xt / Fizz Buzz
Created August 5, 2014 09:04
Fizz Buzz
var fs = require("fs");
fs.readFileSync(process.argv[2]).toString().split('\n').forEach(function (line) {
var myArray = line.split(" "),
output = new Array()
for (var i=1; i<=myArray[2];i++) {
if (i % myArray[0] == 0) {
if (i % myArray[1] == 0) {
output.push("FB")
} else {
@P1xt
P1xt / Set Intersection
Created August 5, 2014 09:08
Set Intersection
var fs = require("fs");
fs.readFileSync(process.argv[2]).toString().split('\n').forEach(function (line) {
if (line != "") {
console.log(processLine(line));
}
});
function processLine(line) {
var lists = line.split(";");
@P1xt
P1xt / C++ Hello World
Created August 5, 2014 17:26
C++ Hello World
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
cin.get();
return 0;
@P1xt
P1xt / Exercise 2
Created August 5, 2014 19:12
Exercise 2
/**
* Change the "Hello, World!" example above to display another line.
* If Spock were doing this exercise, he might add to
* it so that it would display:
*
* Hello, World!
* Live long and prosper.
*
**/