Skip to content

Instantly share code, notes, and snippets.

@roneesh
roneesh / web-components-guide-nov-2019.md
Last active November 22, 2019 20:20
A Guide To Using Web Components from November 2019

A Guide To Using Web Components from November 2019

Contents

  1. What Are Web Components Really
  2. Survey of Available Resources.
  3. Considerations to take into account.
  4. Writing Web Components Plainly
  5. Writing Web Components With Libraries
  6. Writing Web Components With Frameworks
@roneesh
roneesh / gist:310c39f82db09def89c1fd98e4364e40
Created March 7, 2017 02:58
An example of properly formatted code
function underToCamel(underName) {
var camelCaseOutput = "";
var foundunder = false;
for( var i = 0; i < undername.length; i++) {
// undername[i];
if (undername[i] === "_") {
foundunder = true;
} else {
if (foundunder) {
camelcaseoutput += undername[i].toUpperCase();
@roneesh
roneesh / gist:ba629414e6fedc1abf95885d43211a1f
Created March 3, 2017 03:39
Drake Poem Generator Using Markov Chains
function parseText(text) {
return text.split(' ').map(function(currentValue, index, array) {
return currentValue.toLowerCase().replace(/[.,']/g,"");
});
}
function generateWordPairs(text) {
var parsedText = parseText(text);
var wordPairs = {};

Keybase proof

I hereby claim:

  • I am roneesh on github.
  • I am roneesh (https://keybase.io/roneesh) on keybase.
  • I have a public key whose fingerprint is 0436 6BBB BE9B F757 01D5 59EE DD53 4D11 3B5E 8261

To claim this, I am signing this object:

@roneesh
roneesh / gist:7be487be02d58ff16399
Created February 5, 2016 22:19
Several crackle pop solutions
// an uncommon implementation that creates a 100 character string, and replaces each character with either it's index or the crackle/pop/cracklepop
var s = (new Array(102).join('x')).replace(/x/g, function(match, index) {
return (index % 15 === 0 ? 'CracklePop\n' : (index % 5 === 0 ? 'Pop\n' : (index % 3 === 0 ? 'Crackle\n' : (index + '\n'))));
});
console.log(s);
// an uncommon implementation that uses an array and it's shifting to traverse the array
var numbers = Object.keys(new String(new Array(102)));
numbers.shift();
while (numbers.length) {
@roneesh
roneesh / gist:64ecd0bae69ec0efc8a2
Last active August 29, 2015 14:22
A clojure multi-if macro
; first try
; broke because the macro ended up evaluating the condition and just being an instruciton to do the pass or fail
;(defmacro multi-if [test pass fail] (list 'if test (do pass) (do fail)))
; second try including arity and notice the returning of a construction
;(defmacro multi-if [test & {then :then else :else}] (list 'if test (cons 'do then) (cons 'do else)))
; third try, seems to have proper way of supplying map to macro as argument
;(defmacro multi-if [test & {:keys [then else]}] (list 'if test (cons 'do then) (cons 'do else)))
@roneesh
roneesh / gist:a082c84e09c4a0c47c46
Last active May 26, 2016 06:59
Front-end framework using object.observe! (just the JS)
var person = {
name: 'Dude!',
age: '100',
profession :'Welder'
},
hook = document.getElementById('hookOne');
function render(location, object) {
location.innerHTML = '';
var newBio = document.createElement('div');
@roneesh
roneesh / gist:1d64cc9009281790496d
Last active August 29, 2015 14:17
Object.observe trial
<html>
<head>
<style>
.hook {
width: 200px;
height: 200px;
background-color: rgba(0,0,0, 0.5);
border-radius: 15px;
color: white;
@roneesh
roneesh / gist:92505c7c763b6db2f758
Created August 18, 2014 16:39
This gist is an example of a text box having faded out text rather than an overflow scroll bar
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<link rel="stylesheet" href="http://brick.a.ssl.fastly.net/Latin+Modern+Roman:400">
<style>
p { font-size: 22px; font-family: 'Latin Modern Roman'; width: 100%;}
div { margin: 0; margin-left: 100px;}
.text-box {
width: 415px;
@roneesh
roneesh / gist:7254605
Created October 31, 2013 18:31
This is my first line of thinking. I have had all the individual social class sub-class from SocialData, and each one only has four methods, initialize, symbolize, shares, and response, which is protected in each. This idea came about because I wanted to escaped_url to be a single method definition across all the sub-classes (DRY). Currently the…
require 'typhoeus'
require 'uri'
class SocialData
attr_accessor :url
def initialize(url)
self.url = url
end