Skip to content

Instantly share code, notes, and snippets.

@drinkspiller
drinkspiller / grid.ts
Created August 26, 2024 19:45
Creates a grid that returns an array for laying out objects in a grid.
/** Defines a Point. */
export interface Point {
x: number;
y: number;
}
/**
* Creates a grid that returns an array for laying out objects in a grid.
*
* @param columns An integer representing the number of columns to be created
server {
listen 80;
server_name adtweb;
# root directive should be global
root /Users/drinkspiller/Sites/adt_web/;
index index.php;
location / {
(*
* Finder Open iTerm Here - v1.0.2 - 4/14/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Finder"
(*
* Finder Open iTerm Here - v1.0.2 - 4/14/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Finder"
<?php
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking spaces and <br />s for tabs and linebreaks
* @return string The prettified output
* @author Jay Roberts
*/
# Test URI
# Ignore netbeans folder
nbproject/*
# Ignore private folder
/app/private/*
!/app/private/empty
# Ignore packed asset files
/app/webroot/css/packed/*
@drinkspiller
drinkspiller / slug.js
Last active December 17, 2015 22:19 — forked from bentruyman/slug.js
// Generates a URL-friendly "slug" from a provided string.
// For example: "This Is Great!!!" transforms into "this-is-great"
//
// to specify custom replacement string: generateSlug("this is a test", "_");
// becomes: "this_is_a_test"
function generateSlug (value, replacement) {
// 1) convert to lowercase
// 2) remove dashes and pluses
// 3) replace spaces with dashes
// 4) remove everything but alphanumeric characters, dashes, and any custom replacement string
#!/bin/bash
human_filesize() {
local fsize=$1
echo "fsize = $fsize"
declare -a units=(' B', ' KB', ' MB', ' GB', ' TB')
for (( i=0; $fsize > 1024; i++ ))
do
local fsize=$(echo "scale=2;$fsize/1024" | bc )
echo "now fsize = $fsize"
done
$ filesize="352533523322523"
$ fsize=$(echo "scale=2;$filesize/1024" | bc )
bash: 344271018869.65: command not found
$("input[type=button].mais").click(function() {
$(this).prev().val(parseFloat($(this).prev().val()) + 1);
console.log("Sending ID: " + $(this).attr('id'));
var data = {id: $(this).attr('id'),
quantidade: 1};
$.ajax({
type: 'POST',
url: 'http://127.0.0.1/Conveniencia/session/add',
data: data
});