Skip to content

Instantly share code, notes, and snippets.

@coma
coma / js
Created April 22, 2022 14:46
Testing postMessage
window.addEventListener('message', event => console.log('🏴‍☠️', event.data));
@coma
coma / machine.js
Last active December 21, 2020 07:20
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
(function () {
var box = document.getElementById('box');
var color = function (node) {
return node.style.backgroundColor;
};
var last, i = 0;
serviceMod.service('stompMessageService',function($rootScope){
var mz = {msg:'initValue'};
function connect() {
var url='/hello/simplemessages';
var socket = new SockJS(url);
stompClient = Stomp.over(socket);
<div class="colors" ng-controller="Modal">
<a href="" ng-repeat="color in colors" ng-click="select(color)" ng-style="{'border-color': color.hex}">{{ color.name }}</a>
</div>
[{"Title":"All Quiet on the Western Front","Rating":"8.1","Year":"1930","Genre":"Drama , War"},{"Title":"Gone with the Wind","Rating":"8.2","Year":"1939","Genre":"Drama , Romance , War"},{"Title":"The Wizard of Oz","Rating":"8.2","Year":"1939","Genre":"Adventure , Family , Fantasy , Musical"},{"Title":"Fantasia","Rating":"7.9","Year":"1940","Genre":"Animation , Family , Fantasy , Music"},{"Title":"Pinocchio","Rating":"7.6","Year":"1940","Genre":"Animation , Adventure , Drama , Family , Fantasy , Music"},{"Title":"The Great Dictator","Rating":"8.5","Year":"1940","Genre":"Comedy , Drama , War"},{"Title":"Citizen Kane","Rating":"8.5","Year":"1941","Genre":"Drama , Mystery"},{"Title":"Dumbo","Rating":"7.3","Year":"1941","Genre":"Animation , Family , Musical"},{"Title":"Bambi","Rating":"7.4","Year":"1942","Genre":"Animation , Drama , Family"},{"Title":"Casablanca","Rating":"8.7","Year":"1942","Genre":"Drama , Romance , War"},{"Title":"It's a Wonderful Life","Rating":"8.7","Year":"1946","Genre":"Drama , Family , Fa
@coma
coma / SassMeister-input.scss
Created February 12, 2014 09:50
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.3)
// Compass (v1.0.0.alpha.18)
// ----
@charset 'UTF-8';
@import "compass/css3";
@import url(http://fonts.googleapis.com/css?family=Inder);
$(function() {
$('#basic').MomentPicker();
});
(function($, _, undefined) {
var resetTime = function(m) {
return m.hour(0).minute(0).second(0);
};
$.fn.CalendarWidget = function(options) {
var pluginName = 'CalendarWidget';
@coma
coma / AppKernel.php
Created March 20, 2013 16:06
Idea para solucionar el problema de los plurales en castellano para Symfony.
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Doctrine\Common\Inflector\Inflector;
class AppKernel extends Kernel
{
public function __construct($environment, $debug)
{
Inflector::rules('singular', [
'/(d|n|r|s)es$/i' => '\1\2',