Skip to content

Instantly share code, notes, and snippets.

@Keeo
Keeo / fan_ircodes.txt
Created December 7, 2019 17:47
IR Codes for fan
#
# https://www.sbprojects.net/knowledge/ir/nec.php
#
Power On/Off
Protocol : NEC
Code : 0xFFA25D (32 Bits)
uint16_t rawData[71] = {9058, 4466, 596, 534, 596, 538, 596, 538, 596, 538, 596, 538, 596, 538, 596, 538, 596, 538, 596, 1648, 596, 1652, 596, 1652, 596, 1652, 596, 1648, 596, 1652, 596, 1652, 596, 1652, 596, 1652, 596, 538, 596, 1652, 596, 538, 596, 538, 590, 538, 596, 1652, 596, 538, 596, 538, 596, 1652, 596, 538, 596, 1648, 600, 1648, 594, 1652, 596, 538, 596, 1652, 596, 40234, 9064, 2196, 596}; // NEC FFA25D
uint32_t address = 0x0;
uint32_t command = 0x45;
@Keeo
Keeo / yamaha-ras13
Last active April 6, 2024 15:49
Yamaha IR Codes
#
# Yamaha IR codes from RAS13 ZN04290, used for Yamaha A-S301.
# If you find standalone on an off codes please let me know.
# https://www.sbprojects.net/knowledge/ir/nec.php
#
CD on/off
Protocol : NEC
Code : 0x9E6106F9 (32 Bits)
uint16_t rawData[71] = {9012, 4418, 618, 1618, 612, 504, 612, 496, 618, 1614, 616, 1614, 618, 1612, 618, 1614, 616, 496, 612, 504, 612, 1618, 612, 1614, 616, 504, 612, 496, 618, 500, 612, 514, 612, 1608, 618, 500, 612, 500, 612, 504, 612, 500, 612, 500, 616, 1614, 616, 1614, 616, 500, 616, 1614, 618, 1610, 616, 1612, 618, 1612, 618, 1612, 618, 500, 618, 496, 616, 1614, 618, 40206, 8780, 2186, 618}; // NEC 9E6106F9
@Keeo
Keeo / controllers.application.js
Last active October 4, 2017 21:44
Computed properties
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@Keeo
Keeo / base-form.js
Last active October 19, 2016 21:37
Custom form skeleton for ember
import Ember from 'ember';
const {assert, get, computed, isArray, RSVP} = Ember;
const {keys} = Object;
const {service} = Ember.inject;
const {later} = Ember.run;
export default Ember.Component.extend({
validation: service(),
fields: undefined,
errors: undefined,
@Keeo
Keeo / auth.js
Last active October 4, 2015 17:52
//app/sessions/application
import Session from 'simple-auth/session';
import Ember from 'ember';
const { computed } = Ember;
const { service } = Ember.inject;
export default Session.extend({
store: service(),
user: computed('secure.userId', function(){
return this.get('store').findRecord('user', this.get('secure.userId'));
// created by https://github.com/decasia
rollbackAttributes: function() {
this._super();
this.rollbackRelationships();
},
rollbackRelationships: function() {
var model = this;
model.eachRelationship(function(name, meta) {
@Keeo
Keeo / gist:37cd5a31efd7c73da166
Created July 12, 2015 22:24
Ember serializer fn to save only dirty properties
// original thread: http://discuss.emberjs.com/t/dirt-tracking-with-ember-data-only-save-dirty-properties/4191/22
// made by Glavin001
serializeAttribute: function(snapshot, json, key, attributes) {
// Check if new record
if (snapshot.get('isNew')) {
// Is new
return this._super(snapshot, json, key, attributes);
} else {
// Check if current attribute is in flight
public function allAction(ParamFetcher $paramFetcher, Request $request)
{
$data = $this->getResults($paramFetcher, $request);
foreach ($data['post'] as $post /* @var $post Post */) {
$comments = [];
$s = &$ret['post'][];
$s['id'] = $post->getId();
$s['company'] = $post->getCompany()->getId();
foreach ($post->getComments() as $comment) {
$comments[] = $comment->getId();
import Ember from 'ember';
export default Ember.Mixin.create({
currentRequest: 0,
majax: function (ajax, success, fail) {
var _this = this;
var cr = this.get('currentRequest');
this.set('currentRequest', ++cr);
ajax.then(function (payload) {
if (_this.get('currentRequest') === cr) {
@Keeo
Keeo / store.js
Last active August 29, 2015 14:17
Ember data custom store function able to find entity by custom field not id only. Usefull for finding by secondary keys as slug or name.
// for ember-cli place in app/store.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.Store.extend({
/**
* Acts as find(type, id) but can be used on any field.
* @param type