Skip to content

Instantly share code, notes, and snippets.

@krusynth
krusynth / google-fonts.md
Created November 18, 2014 16:39
Actually Pretty Good Google Fonts
@krusynth
krusynth / vegan_potato_salad
Created November 19, 2014 01:47
Vegan Potato Salad
To celebrate the fourth, here's Bill's Vegan Potato Salad! (Gluten free as well!) Super creamy and delicious, almost makes you think you're eating the dairy-thing. Makes about 8-10 servings, depending on your appetite.
Red Potatoes 5 lbs
Dill, finely chopped 1/4 Cup
Olive oil 1/2 Cup
Rice Vinegar 1/2 Cup
Sea Salt 1 teaspoon
Black Pepper, fresh ground (a dash)
Wash and prep the potatoes, leaving the skins on, and cut into 1/2 inch cubes. Throw them into a large pot with salted water, and boils for 30 minutes.
While the potatoes are cooking, remove the stalks from your dill and chop a fistful or so, to yield 1/4 cup.
After the potatoes are done cooking, drain with a large colander. At this point, you can either put them in the refrigerator to cool, or speed up the process by dipping them into an ice bath. After they've cooled, dab off any extra water with a paper towel.
@krusynth
krusynth / rename.sh
Created December 6, 2014 17:54
file rename bash
# Find a *lot* of files with the wrong extension and fix the extension.
for myfile in $(find /var/www/releases/sanfranciscocode/*/production/current/htdocs/downloads/current/code-text -name "*..txt" -type f); do
filetrim=${myfile%????};
mv $myfile $filetrim"txt";
done;
@krusynth
krusynth / .bash_profile
Created December 8, 2014 00:49
Bash script to delete all documents from a Solr core.
# Put this at the end of your .bash_profile.
#
# Usage: clearsolr corename
clearsolr() {
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<commit />'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<optimize />'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<commit />'
}
@krusynth
krusynth / DocumentController.js
Created December 8, 2014 21:56
Sails.js Controller using etherpad-lite-client
var etherpad_client = require('etherpad-lite-client');
module.exports = {
/**
* list() - list all docs
*/
list: function(req, res) {
etherpad_api = etherpad_client.connect({
apikey: sails.config.connections.etherpad.apikey,
host: sails.config.connections.etherpad.host,
@krusynth
krusynth / dataTables_patch.js
Created January 13, 2015 04:00
dataTables.js requires you to have "good" tables. If your table has an uneven number of columns per row, and you're getting the dreaded " Cannot read property 'mData' of undefined " this will fix it.
// dataTables.js is great! But it requires you to have "good" tables in
// the first place. If your table has an uneven number of columns per
// row, and you're getting the dreaded "Cannot read property
// 'mData' of undefined" this'll fix it. If you're missing a thead or
// tbody you'll get that error too - this won't fix that!
$(document).ready(function() {
// We need to make sure every row in our table has the same number of columns.
// Otherwise dataTable doesn't work.
$('table').each(function(i, elm) {
@krusynth
krusynth / indexSpec.js
Created January 21, 2015 15:24
Example using Squire for Dependency injection.
define(['squire'], function (Squire) {
"use strict";
describe("DashboardIndexController", function () {
var context = {};
var ready = false;
beforeEach(function () {
runs(function () {
context.injector = new Squire();

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@krusynth
krusynth / date-query.txt
Created May 12, 2015 13:52
Handling multifield dates. Please don't do this. It's bad - unmanageable, unreadable.
mysql> desc testdates;
+-------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| year | smallint(5) unsigned | YES | | NULL | |
| month | tinyint(3) unsigned | YES | | NULL | |
| day | tinyint(3) unsigned | YES | | NULL | |
+-------+----------------------+------+-----+---------+----------------+
#!/bin/bash
#
# solr APACHE SOLR 4.10
#
# chkconfig: 2345 85 15
# description: Startup Script for APACHE SOLR 4.10
#
# processname: solr