Skip to content

Instantly share code, notes, and snippets.

Javis Sullivan trendsetter37

Block or report user

Report or block trendsetter37

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View echo-thumbnail-url.php
<?php echo gangmei_get_the_post_thumbnail_url($post->ID, 'large'); ?>
View prefix_expressions.rb
#Ruby Prefix expressions problem on codeeval.com
File.open(ARGV[0]).each_line do |line|
# get operators using a regex
operators = line.scan(/[*+\/]/) #return list of operators
operators.reverse!
# This skips over spaces as well regex here once again
@trendsetter37
trendsetter37 / max_xor.cs
Last active Aug 29, 2015
Maximizing XOR HackerRank Challenge in C#
View max_xor.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
class Solution {
public static List<int[]> Combinations( List<int> numberList )
{
@trendsetter37
trendsetter37 / PrimeQuadruplets.java
Created Oct 6, 2014
Calculating Prime Quadruplets in Java
View PrimeQuadruplets.java
package primequads;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author trendsetter37
*
* prime quadruplets > 3 Take the form of {p, p+2, p+6, p+8} There should be 7
@trendsetter37
trendsetter37 / halloween_party.clj
Created Oct 6, 2014
Halloween Party Solution in clojure
View halloween_party.clj
;https://www.hackerrank.com/challenges/halloween-party
(defn determine_pieces [number]
(if (= (mod number 2) 0)
(* (/ number 2) (/ number 2))
(* (quot number 2) (+ (quot number 2) 1)))) ;quot is clojure's version of non-float division
(dotimes [i (Integer/parseInt (read-line))]
(let [input (Integer/parseInt (read-line))]
(println (determine_pieces input))))
@trendsetter37
trendsetter37 / delta_time.c
Created Oct 19, 2014
Codeeval Challenge Delta Time
View delta_time.c
/* https://www.codeeval.com/open_challenges/166/ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1024
int time_difference(char* time1, char* time2);
void seconds_to_time(int seconds);
int main(int argc, char** argv)
@trendsetter37
trendsetter37 / txtfile-input.clj
Created Oct 19, 2014
Read text files into Clojure REPL
View txtfile-input.clj
; This is to read files into repl for dev work
; You would replace println with your function
; That you would like to test on each line of
; the text file.
(defn do-stuff [file] ; file should be a string surrounded by double quotes
(with-open [rdr (clojure.java.io/reader file)]
(doseq [line (remove empty? (line-seq rdr))]
(println line))))
@trendsetter37
trendsetter37 / cut-the-sticks.lisp
Last active Aug 29, 2015
HackerRank challenge Cut The Sticks in Common Lisp
View cut-the-sticks.lisp
(defun space-split (string)
"works for integers only at this point"
(loop for start = 0 then (1+ finish) ;; increments start by the value of finish
for finish = (position #\Space string :start start) ;; gives position of the next space begins at start
collecting (parse-integer (subseq string start finish)) ;; gathers integers from string list
until (null finish))) ;; continue until finish is nil (runs off the end of the string)
(defun cut-sticks (sticks)
(do ((rest (sort sticks #'<)
(remove (car rest) rest)))
@trendsetter37
trendsetter37 / string_permutations.py
Last active Aug 29, 2015
String permutations Hard challenge on CodeEval
View string_permutations.py
import itertools
import sys
def sort_perm(perm_list):
''' This will sort the list of permutations in
your into a list of tuples/list'''
teh_list = sorted(perm_list)
for item in teh_list:
if (item == teh_list[len(teh_list) - 1]):
@trendsetter37
trendsetter37 / GoT.lisp
Last active Aug 29, 2015
Game of Thrones Warmup I on hackerRanck
View GoT.lisp
(defparameter *letter-hash* (make-hash-table :size 100000))
(defvar even-length)
(defvar number-of-odds 0)
(defun string-to-list (&key word)
"Will set the even/odd param as well"
(setq even-length (evenp (length word)))
(loop for letter across word collect letter))
You can’t perform that action at this time.