Skip to content

Instantly share code, notes, and snippets.

@webdesserts
webdesserts / arrays.js
Last active October 1, 2015 23:57
How to pass values into an array - a snippet for some friends
var array = []
array[1] = "a value"
array[2] = "a new value"
console.log(array) // returns ["a value","a new value"]
// p.s. console.log() and alert() are interchangeable. If you use console.log the
// message appears in your browser's console rather than in a popup.
// That's kinda obvious but here's something your probably haven't used yet:
@webdesserts
webdesserts / https.rb
Created May 24, 2012 19:50
This is a snippet of code for connecting to an https server via Ruby's Net::HTTP class
uri = URI('https://www.your-site.com/home/')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
# use OpenSSL::SSL::VERIFY_PEER instead and https.ca_file for a verified cert
https.start do |http|
request = Net::HTTP::Get.new uri.request_uri
request.basic_auth 'username','password'
response = https.head('/home/')
@webdesserts
webdesserts / correct.rb
Created July 4, 2012 16:19
How to tell your programmer to go grocery shopping
#The Ruby code your mom should have handed you:
# products = { milk => [], eggs => [] }
# cart = []
cart << products[:milk].pop
if !products[:eggs].empty?
6.times do
cart << products[:eggs].pop
@webdesserts
webdesserts / corgi.coffee
Created August 13, 2012 04:33
Corgi Bomb modified
# Description:
# Corgime
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@webdesserts
webdesserts / sidebar.md
Last active December 13, 2015 20:18
Side Bar Observations for SublimeText3

#ST3 Side Bar

##Commands

  • reveal_in_side_bar
    • opens sidebar if it is hidden
    • highlights currently selected file (and opens it's containing folders)
  • focus_side_bar
    • ctrl+0
  • moves "cursor" to side bar
@webdesserts
webdesserts / JS_Intro.md
Last active December 15, 2015 16:59
This is an ongoing attempt to build an introductory slideshow to JavaScript for those I meet who are new to the language.

What is JavaScript?

##What is JavaScript? Created by Brendan Eich in 1995 for the Netscape browser

###Features

  • functional
  • object oriented
  • asyncronous
  • event-based
@webdesserts
webdesserts / line-splitter.js
Last active December 15, 2015 18:19 — forked from deoxxa/line-splitter.js
Creates a transform stream that splits any stream pipped into it into lines.
var stream = require("stream"),
util = require("util");
var LineSplitter = function LineSplitter(options) {
options = options || {};
options.objectMode = true;
stream.Transform.call(this, options);
this.buffer = "";
};
util.inherits(LineSplitter, stream.Transform);
@webdesserts
webdesserts / Gulpfile.js
Last active April 3, 2023 08:16
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
@webdesserts
webdesserts / Readme.md
Last active December 27, 2015 10:39
A quick overview of how the webdesserts.com website will be built

webdesserts.com

Development

  1. Content - first, we have to have a reason to have a website. In all honesty the main purpose of this website is to host an online resume and show off my design abilities. But in reality that's a poor purpose for a site. I need content. Real content. So if I'm going to have to start a blog, let's at least make it useful to people other than me. I will write all my content first before I write a single line of code.
  2. Design - I will need mockups. Initially, this should probably be done in Photoshop. If I feel like going the extra step, I might finish the design in Adobe Reflow, just to get a feel for how the website might act. However, this site is probably small enough that I can just start prototyping in the browser.
  3. Frontend - After the design phase, I will write a static version of the frontend. Everything will be hardcoded. Nothing will be dynamic. This is just for working out the css and transitioning the site from it's wire
@webdesserts
webdesserts / hand_written.svg
Created December 7, 2013 21:06
Hand written SVG by Sven_vB Original link here: http://paste.ohai.su/ptmswxggy/2iymbd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.