Skip to content

Instantly share code, notes, and snippets.

View benjamincharity's full-sized avatar
🤖

Benjamin Charity benjamincharity

🤖
View GitHub Profile
@benjamincharity
benjamincharity / dabblet.css
Created November 7, 2012 21:17
CSS Border with Box-Shadow Example
/**
* CSS Border with Box-Shadow Example
*/
div {
/* Borders */
box-shadow: 0 0 0 6px rgba(0,0,0,0.2), 0 0 0 12px rgba(0,0,0,0.2), 0 0 0 18px rgba(0,0,0,0.2), 0 0 0 24px rgba(0,0,0,0.2);
/* Meaningless pretty things */
background: linear-gradient(45deg, powderBlue, ghostwhite);
@benjamincharity
benjamincharity / autonomous.txt
Last active April 12, 2024 22:20
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@benjamincharity
benjamincharity / Local Fallback for jQuery and Modernizr
Created January 6, 2012 17:31
Include jQuery and Modernizr from a CDN and add local fallbacks in case the CDN fails. Versions written in HTML and HAML.
HTML
=====
<script type='text/javascript'>
window.jQuery || document.write('<script src="js/jquery-1.7.1.js">\x3C/script>')
</script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.6/modernizr.min.js' type='text/javascript'></script>
<script type='text/javascript'>
window.Modernizr || document.write('<script src="js/modernizr-2.0.6.js">\x3C/script>')
</script>
@benjamincharity
benjamincharity / clearCache.sh
Created March 3, 2017 16:44
Clear the cache for a CircleCI project.
curl -X DELETE https://circleci.com/api/v1/project/:username/:project/build-cache?circle-token=:token
@benjamincharity
benjamincharity / master.vim
Last active June 30, 2023 08:45 — forked from gmccreight/master.vim
Master Vim with this interactive tutorial.
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@benjamincharity
benjamincharity / deletebranch.gitconfig
Last active May 10, 2023 14:39
Git alias function to delete local AND remote branch(s). NOTE: If dealing with branches that are not fully merged, the `-d` would need to change to `-D`.
[alias]
deletebranch = "!f() { \
git push origin --delete "$@"; \
git branch -d "$@"; \
}; f"
# usage:
# git deletebranch my-branch
# git deletebranch branch-1 branch-2 branch-3
@benjamincharity
benjamincharity / mockActivatedRoute.ts
Created April 12, 2017 16:23
Mock ActivatedRoute with params, data and snapshot.
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MdToolbarModule,
],
providers: [
{
provide: Router,
useClass: MockRouter,
},
@benjamincharity
benjamincharity / contacts.js
Last active January 9, 2023 16:06
Create a downloadable file of VCARD formatted address for iOS from a JSON array.
var contacts =
[
{
"notes": [
{
"description": "Fugiat aute pariatur excepteur elit."
}
],
"tels": [
{
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@benjamincharity
benjamincharity / CreateGuid.ts
Created August 10, 2017 12:15
A TypeScript class that generates a guid
// http://stackoverflow.com/questions/26501688/a-typescript-guid-class
class Guid {
static newGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0, v = c === 'x' ? r : ( r & 0x3 | 0x8 );
return v.toString(16);
});
}
}