Skip to content

Instantly share code, notes, and snippets.

@zakdances
zakdances / easy.js
Last active May 6, 2022 01:26
easy puzzle
// Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
// You may assume that each input would have exactly one solution, and you may not use the same element twice.
// You can return the answer in any order.
// Example 1:
@zakdances
zakdances / hard.js
Last active May 6, 2022 01:26
hard puzzle
// Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
// The overall run time complexity should be O(log (m+n)).
// Example 1:
// Input: nums1 = [1,3], nums2 = [2]
// Output: 2.00000
@zakdances
zakdances / medium.js
Created May 6, 2022 01:22
medium puzzle
// Given a string s, return the longest palindromic substring in s.
// Example 1:
// Input: s = "babad"
// Output: "bab"
// Explanation: "aba" is also a valid answer.
// Example 2:
<?php
class SlugService
{
public function slugify($string)
{
$sep = '-';
// Replace special chars with hyphen
@zakdances
zakdances / Contract Killer 3.md
Created May 5, 2017 03:14 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@zakdances
zakdances / Git Cheatsheet
Last active April 28, 2016 09:04
Git cheatsheet
// Create new branch 👉 track new branch 👉 switch to new branch
git checkout -b <branch> --track
git update-index --assume-unchanged <file>
git remote -v
git remote add upstream -f https://github.com/otheruser/repo.git
git remote set-url origin git://new.url.here
@zakdances
zakdances / Grunt Cheatsheet
Created December 23, 2013 00:49
Grunt Cheatsheet
in .bash_profile:
# Install a grunt plugin and save to devDependencies
function gi() {
npm install --save-dev grunt-"$@"
}
# Install a grunt-contrib plugin and save to devDependencies
function gic() {
npm install --save-dev grunt-contrib-"$@"
@zakdances
zakdances / js2coffee Cheatsheet
Last active January 1, 2016 04:09
js2coffee cheatsheet
js2coffee file.js > file.coffee -V -it -sq
# The help banner that is printed when `js2coffee` is called without arguments.
BANNER = """
Usage: js2coffee [options] path/to/script.js
js2coffee file.js
js2coffee file.js > output.coffee
cat file.js | js2coffee
Pod::Spec.new do |s|
s.name = 'CocoaHTTPServer'
s.version = '2.4'
s.license = 'BSD'
s.summary = 'A small, lightweight, embeddable HTTP server for Mac OS X or iOS applications.'
s.homepage = 'https://github.com/robbiehanson/CocoaHTTPServer'
s.authors = { 'Robbie Hanson' => 'cocoahttpserver@googlegroups.com' }
s.source = { :git => 'https://github.com/zakdances/CocoaHTTPServer.git', :tag => "#{s.version}" }
s.source_files = '{Core,Extensions}/**/*.{h,m}'
s.requires_arc = true
pod spec create Peanut
edit Peanut.podspec
pod spec lint Peanut.podspec