Skip to content

Instantly share code, notes, and snippets.

@DenimTornado
DenimTornado / add_event
Created July 24, 2014 11:32
Event handler
var add_event = function (object, event, callback) {
object = get_element(object);
if (!object) {
return;
}
if (object && object.addEventListener) {
object.addEventListener(event, callback, false);
}
@DenimTornado
DenimTornado / jsbin.lebiqahu.html
Last active August 29, 2015 14:04
Adding onclick handlers to the multi elements with condition
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="container">
<button id="b1">Кнопка</button>
<button id="b2">Кнопка</button>
function lengthOf(object) {
var element_count = 0;
for (e in object) { element_count++; }
return element_count;
}
function _jqCacheSize(){return lengthOf($.cache);}
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-git2.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
#
# Original version by Grant Parnell is offline (http://digitaldj.net/2011/07/21/trim-enabler-for-lion/)
# Update July 2014: no longer offline, see https://digitaldj.net/blog/2011/11/17/trim-enabler-for-os-x-lion-mountain-lion-mavericks/
#
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
#
# Alternative to http://www.groths.org/trim-enabler-3-0-released/
# Method behind this madness described: http://forums.macrumors.com/showthread.php?t=1409151&page=4
# See discussion in comments here: https://www.macupdate.com/app/mac/39654/lion-tweaks
# And here: http://forums.macrumors.com/showthread.php?t=1410459
# disable local snapshots feature of time machine
sudo tmutil disablelocal
# undo
#sudo tmutil enablelocal
# delete all mobile backups
# repeat after every new backup drive selection
sudo rm -r /.MobileBackups
var facebook = {
"data": [
{
"country_code": "US",
"name": "United States",
"supports_region": "true",
"supports_city": "true"
},
{
"country_code": "CA",
@DenimTornado
DenimTornado / gist:0596375b4c2e9def372d
Last active September 24, 2015 15:25
Colorised every third day in Superjob.ru calendar in 2015
var data = [
{month: 1, reminder: 0},
{month: 2, reminder: 2},
{month: 3, reminder: 1},
{month: 4, reminder: 2},
{month: 5, reminder: 1},
{month: 6, reminder: 2},
{month: 7, reminder: 1},
{month: 8, reminder: 0},
{month: 9, reminder: 1},
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function base64Encode(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = _utf8_encode(input);
while (i < input.length) {
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
testAction() {
alert('Enter pressed');
},
testAction2() {
alert('Second Enter pressed');
}