Skip to content

Instantly share code, notes, and snippets.

@sshadmand
sshadmand / Borderizer
Created August 16, 2015 02:11
Add borders to all your elements when testing out layout element sizing.
function borderizer(){
var all = document.querySelectorAll("*");
var rgb = [0, 0, 0];
for (var i=0, max=all.length; i < max; i++) {
all[i].style.border = "solid";
all[i].style.borderWidth = "1px";
}
}
@sshadmand
sshadmand / flash-animation.html
Last active August 29, 2015 14:28
Polymer 1.0 Neon Animations
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/neon-animation/neon-animation-behavior.html">
<link rel="import" href="../../bower_components/neon-animation/web-animations.html">
<!--
`<fade-in-animation>` animates the opacity of an element from 0 to 1.
Configuration:
```
{
@sshadmand
sshadmand / Polymer Cache bust for dev
Created September 4, 2015 14:14
Gulp Compiler Helpers
/*
Based on Cachebust
Fixes issue where the original cachebust doesn't see custom polymer elements. Ignores bower_components where polymer elements reside which will cause polymer issues.
*/
var $ = require('cheerio'),
MD5 = require('MD5');
exports.busted = function(fileContents, options) {
/* For elements in Polymer. Since Polymer
@sshadmand
sshadmand / Audio Player
Last active October 6, 2015 22:10
Sample Polymer 1.0 Elements
<link rel="import" href="../../bower_components/polymer/polymer.html">
<!--
Plays audio files.
Example:
<audio-player></audio-player>
@demo
@sshadmand
sshadmand / fb_messenger_webhook.py
Last active January 7, 2019 04:11
FB Messenger Webhook Ported to Python
import json
import requests
from django.views.decorators.csrf import csrf_exempt
FB_MESSENGER_ACCESS_TOKEN = "[TOKEN]"
def respond_FB(sender_id, text):
json_data = {
"recipient": {"id": sender_id},
@sshadmand
sshadmand / Advanced Reads
Created October 9, 2016 18:15
Arduino Pressure Sensitive Fabric Tutorial Code
#include <math.h>
int myPin = 0;
int touching = false;
int touchingCount = 0;
void setup() {
Serial.begin(9600);
}
@sshadmand
sshadmand / filter_tree.js
Last active October 15, 2016 01:50
Recursive Filter on Tree Dict (JSON)
outline = [{
id: 1,
children: [{
id: 3,
label: 'goodbye',
children: []
}],
label: 'hello'
},
{
@sshadmand
sshadmand / Adding tmux
Last active May 4, 2022 19:44 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
Create a tmux conf file
#> touch ~/.tmux.conf
Install TMP
#> git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
[Copy and paste tmux.conf below into local file.]
Load tmux configurations
#> tmux source-file ~/.tmux.conf
# This works becuase tagless images look like this:
#
# REPOSITORY TAG IMAGE ID CREATED SIZE
# <none> <none> 39c3774dd2fb 10 minutes ago 417 MB
docker rmi $(docker images -a | grep none)
@sshadmand
sshadmand / .bash_profile
Last active June 28, 2017 06:22
A great Bash profile
# always list date and size info
alias ll='ls -all'
# make sure you are on a protected branch and prome remote and local where no remote exists
alias gitclean='git checkout development; git branch | egrep -v "master|development" | xargs git branch -D'
# list all branch and remote branches
alias gitlist='git branch -a'