Skip to content

Instantly share code, notes, and snippets.

View karloscarweber's full-sized avatar
📱
Building

Karl Weber karloscarweber

📱
Building
View GitHub Profile
@karloscarweber
karloscarweber / addDots.js
Last active December 17, 2015 03:38
Adds a dot to indicate cents.
var intervalID = 0;
timer = 0;
// add's comma's to every third decimal place from the end
intervalID = window.setInterval(function(){
addDots(document.getElementById("bidAmount"))
}, 1);
$('#bidAmount').onKeyUp(delay());
function delay() {
@karloscarweber
karloscarweber / gist:6383452
Last active December 21, 2015 23:39
Code Styling for PHP Documentation
<?php
//Some Coding Standards that I want to follow. I might as well write it down.
/*
* Functions
*/
/*
* Function Names should be lowerecased multiple words should be seperated by underscores
* private methods / functions should begin with an underscore
@karloscarweber
karloscarweber / ready.js
Created October 24, 2013 16:30
All th ways to make a document.ready() event listener for Jquery. see: http://api.jquery.com/ready/ I've had to look this up enough times that I decided to store it somewhere. I don't know why I always forget
/*Classic way*/ // $( document ).ready( handler )
$( document ).ready( function( ) {
// do something.
} )
/* Short Way */ // $( handler )
$( function( ) {
// do something
@karloscarweber
karloscarweber / README.md
Last active July 29, 2016 21:55
A simple Base REST api connector thingy.

Base CRM PHP REST API thingy

So, this is a collection of classes tha makes it way easier to work with most of the base api, getbase.com.

It's organized as follows

index.php

obviously the controller. it uses simple GET urls to determine get, post, put, and delete requests, as well as which resource is being requested.

@karloscarweber
karloscarweber / mandrill.php
Last active July 13, 2017 23:32
A CakePHP 2.0 Component That integrates with the Mandrill API. Just enough to get you started, Fill in the gaps.
<?php
// App/controllers/components/mandrill.php
class MandrillComponent extends Object
{
var $components = array('Session', 'RestRequest');
var $settings = array(
'host' => 'smtp.mandrillapp.com',
'port' => '587',
'username' => 'username',
.my-link {
text-decoration: underline;
}
@karloscarweber
karloscarweber / dither.js
Created June 15, 2018 14:38 — forked from mattdesl/dither.js
dither-blob.js
const sketcher = require('canvas-sketch-tool'); // not yet public
// Import geometry & utilities
const createRegl = require('regl');
const createPrimitive = require('primitive-icosphere');
const createCamera = require('perspective-camera');
const glslify = require('glslify');
const hexRgb = require('hex-rgb');
// Utility to convert hex string to [ r, g, b] floats
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
var t = prompt("Enter text to be sent to console, (This wont send the enter keystroke)").split("");
function f() {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = "!@#$%^&*()_+{}:\"<>?~|".indexOf(character) !== -1
@karloscarweber
karloscarweber / camping.rb
Created August 15, 2022 05:14
The entire Camping Framework
require"uri";require"rack";E||="Content-Type";Z||="text/html"
class Object;def meta_def m,&b;(class<<self;self
end).send:define_method,m,&b end;end;module Camping;C=self;S=IO.read(__FILE__
)rescue nil;P="<h1>Cam\ping Problem!</h1><h2>%s</h2>";U=Rack::Utils;O={url_prefix:""};Apps=[];
SK=:camping;G=[];class H<Hash;def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.
to_s]:super end;undef id,type if ??==63 end;class Cookies<H;attr_accessor :_p;
def _n;@n||={}end;alias _s []=;def set k,v,o={};_s(j=k.to_s,v);_n[j]=
{:value=>v,:path=>_p}.update o;end;def []=(k,v)set(k,v,v.is_a?(Hash)?v:{})end
end;module Helpers;def R c,*g;p,h=
/\(.+?\)/,g.grep(Hash);g-=h;raise"bad route"if !u=c.urls.find{|x|break x if
@karloscarweber
karloscarweber / install.rb
Created September 6, 2022 19:10
Fix RVM Install on M1 Mac
# I often have issues when installing ruby, through rvm, onto an M1 mac.
# It's usually this one problem. But installing with the follwing command almost always works:
# reference: https://github.com/rvm/rvm/issues/5043#issuecomment-811891226
```bash
CFLAGS="-Wno-error=implicit-function-declaration" rvm install 2.6.6
```