Skip to content

Instantly share code, notes, and snippets.

@ChickenFur
ChickenFur / magicnum.js
Created February 21, 2013 05:23
magic number question
var infinteNumber = [4, 0, 20, 42,];
var magicNumberList = {};
var isMagic = function(num){
if(magicNumberList[num])
return true;
var stringNum = num.toString();
var arrayOfDigits = stringNum.split("")
console.log (num)
var magicNumberTotal = 0;
for(var i = 0; i < stringNum.length; i++){
@ChickenFur
ChickenFur / A simple Menu
Last active December 28, 2015 04:19
Menu Control in Coffee Script
setCurrentTab = (newTabNum)->
$navTabs = $(".pimco-container .nav-tab")
for tab in $navTabs
$tab = $(tab)
if $tab.data().tabNum is newTabNum
$tab.addClass("active")
$(".tab-content#{newTabNum}").show()
else
$tab.removeClass("active")
$(".tab-content#{$tab.data().tabNum}").hide()
@ChickenFur
ChickenFur / git-diff-commands.md
Created December 11, 2013 18:57
These two commands creates a tar file of all the changed files and a txt file with a list of the changed files.

git diff --name-only HEAD~1 HEAD | xargs tar -czf files.tar.gz

git diff --name-only HEAD~1 HEAD | > files.txt

#to get the hash of the current commit

git rev-parse HEAD

@ChickenFur
ChickenFur / Package Control.sublime-settings
Last active August 29, 2015 13:57
My Sublime Text 3 Settings
{
"installed_packages":
[
"DocBlockr",
"Emmet",
"Sass",
"SideBarEnhancements",
"SublimeLinter",
"SublimeLinter-coffee",
"SublimeLinter-jshint",
@ChickenFur
ChickenFur / 2.ts
Last active November 23, 2019 19:15
Submission 2
class ListNode {
val: number | null;
next: ListNode | null;
constructor(numbers: Array<number>) {
for (var i = 0; i < numbers.length; i++) {
this.val = numbers[0];
if (i + 1 === numbers.length) {
this.next = null;
} else {
this.next = new ListNode(numbers.splice(i + 1));
@ChickenFur
ChickenFur / 7.ts
Created November 24, 2019 20:27
submission 7
var numberOutofBounds = (numbers: Array<string>) => {
if (numbers.length > 10) {
return true;
}
if (numbers.length <= 9) {
return false;
}
//
//2, 147, 483, 648;
const bounds = {
@ChickenFur
ChickenFur / 4.ts
Created November 26, 2019 02:58
4 ts
var findMedianSortedArrays = (nums1: Array<number>, nums2: Array<number>) => {
const newArray = nums1.concat(nums2);
newArray.sort((a, b) => {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
if (a === b) {
const longestPalindrome = (s: string) => {
const length = s.length;
var result = "";
if (length === 1) {
return s;
}
var fromTheCenter = (left, right) => {
while (left >= 0 && right < length && s[left] === s[right]) {
left--;