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 / 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:
@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
<?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
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 / Bootstrap-Lite
Last active August 29, 2015 14:07
An extremely light-weight version of Bootstrap that can be copy-pasted into projects to eliminate a dependency.
$font-size-base: 14px !default;
$line-height-base: 1.428571429 !default; // 20/14
$font-family-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif !default;
$font-family-serif: Georgia, "Times New Roman", Times, serif !default;
//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.
$font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace !default;
$font-family-base: $font-family-sans-serif !default;
//** Background color for `<body>`.
$body-bg: #fff !default;
@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