Skip to content

Instantly share code, notes, and snippets.

@jaehess
jaehess / binding.js
Created June 5, 2023 22:32 — forked from harish81/binding.js
Simple Two-Way Data Binding Using Javascript Proxies.
function observe(selector,data,listener=null) {
let parent = document.querySelector(selector);
let allBind = parent.querySelectorAll('[data-bind]');
const get = (target, key, receiver)=>{
const result = Reflect.get(target, key, receiver);
return result;
}
const set = (target,key,value,receiver)=>{
Reflect.set(target, key, value, receiver);
updateBinding(key,value);
@jaehess
jaehess / controllers.application.js
Created June 30, 2016 00:35
Add Rows for Aaron
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
rows: [
{name: 'Foo'},
{name: 'Bar'},
{name: 'Baz'},
],
@jaehess
jaehess / README.md
Created October 12, 2013 14:37 — forked from nikcub/README.md
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
SC.Binding.lt = function (max) {
return this.transform(function (value, binding) {
return SC.typeOf(value) === SC.T_NUMBER && value < max;
});
};
SC.Binding.gt = function (min) {
return this.transform(function (value, binding) {
return SC.typeOf(value) === SC.T_NUMBER && value > min;
});
@jaehess
jaehess / app.js
Created November 28, 2012 05:06
Custom Popover Directives
var myApp = angular.module('myApp', []);
myApp.directive('myPopover', function($compile, $timeout) {
var popoverLink = '<a href="#" rel="popover" class="{{cssClasses}}">{{title}}</a>';
return {
restrict: 'E',
scope: true,
compile: function(tElement, tAttributes, transclude) {
var popoverContent = tElement.html();
var title = tAttributes.ngTitle;
@jaehess
jaehess / .gitconfig
Created October 24, 2012 13:51 — forked from macournoyer/.gitconfig
Git shortcuts
[alias]
st = status
s = status
co = checkout
ci = commit -a -v
b = branch
d = diff
p = pull
a = add .
l = log
@jaehess
jaehess / cleanup.rb
Created October 12, 2012 16:40 — forked from MoriTanosuke/cleanup.rb
Delete all your tweets from Twitter with Ruby
require 'twitter'
require 'peach'
USERNAME = '' # put your twitter username here
Twitter.configure do |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_SECRET
@jaehess
jaehess / easy_way.rb
Created September 2, 2012 14:45 — forked from mislav/easy_way.rb
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
end
end