Skip to content

Instantly share code, notes, and snippets.

Cece Hedrick piqueen314

Block or report user

Report or block piqueen314

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 OpenWithSublimeText2.bat
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@piqueen314
piqueen314 / gist:e8a3351ef1ae1e5b0a17
Created Dec 11, 2015
Return the factorial of the provided integer.
View gist:e8a3351ef1ae1e5b0a17
// Bonfire: Factorialize a Number
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-factorialize-a-number
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function factorialize(num) {
var fac=1;
if (num ===0){
return fac;
}
@piqueen314
piqueen314 / gist2
Created Dec 11, 2015
Return true if the given string is a palindrome. Otherwise, return false.
View gist2
// Bonfire: Check for Palindromes
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function palindrome(str) {
// Good luck!
str=str.toLowerCase();
str=str.replace(/\W/g,"").replace(/[_]/g,"");
@piqueen314
piqueen314 / gist3
Created Dec 11, 2015
Return the length of the longest word in the provided sentence.
View gist3
// Bonfire: Find the Longest Word in a String
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function findLongestWord(str) {
var words=str.split(" ");
var max=0;
for (var i=0; i < words.length; i++)
{
@piqueen314
piqueen314 / gist4
Created Dec 11, 2015
Return the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.
View gist4
// Bonfire: Title Case a Sentence
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function titleCase(str) {
var words=str.split(" ");
for(var i=0; i<words.length; i++)
{
words[i]=words[i].toLowerCase();
@piqueen314
piqueen314 / gist 4
Created Dec 11, 2015
Return an array consisting of the largest number from each provided sub-array. For simplicity, the provided array will contain exactly 4 sub-arrays.
View gist 4
// Bonfire: Return Largest Numbers in Arrays
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-return-largest-numbers-in-arrays
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function largestOfFour(arr) {
// You can do this!
var newArr=[];
@piqueen314
piqueen314 / gist5
Created Dec 11, 2015
Check if a string (first argument) ends with the given target string (second argument).
View gist5
// Bonfire: Confirm the Ending
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-confirm-the-ending
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function end(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
lenStr=str.length;
lenTar=target.length;
@piqueen314
piqueen314 / gist6
Created Dec 11, 2015
Repeat a given string (first argument) n times (second argument). Return an empty string if n is a negative number.
View gist6
// Bonfire: Repeat a string repeat a string
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-repeat-a-string-repeat-a-string
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function repeat(str, num) {
// repeat after me
var newStr="";
for(var i=0; i<num; i++){
newStr=newStr.concat(str);
@piqueen314
piqueen314 / g7
Created Dec 11, 2015
Truncate a string (first argument) if it is longer than the given maximum string length (second argument). Return the truncated string with a "..." ending.
View g7
// Bonfire: Truncate a string
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-truncate-a-string
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function truncate(str, num) {
// Clear out that junk in your trunk
if(num <=3)
{
return str.slice(0,num)+"...";
@piqueen314
piqueen314 / g8
Created Dec 11, 2015
Write a function that splits an array (first argument) into groups the length of size (second argument) and returns them as a multidimensional array.
View g8
// Bonfire: Chunky Monkey
// Author: @piqueen314
// Challenge: http://www.freecodecamp.com/challenges/bonfire-chunky-monkey
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function chunk(arr, size) {
var newArr = [];
for (var i=0; i < arr.length; i+=size)
newArr.push(arr.slice(i,i+size));
return newArr;
You can’t perform that action at this time.