Skip to content

Instantly share code, notes, and snippets.

View 0000marcell's full-sized avatar
🌝

Marcell Monteiro Cruz 0000marcell

🌝
View GitHub Profile
@0000marcell
0000marcell / cclient.c
Last active June 7, 2022 16:08
Unix domain clients and servers written in ruby and C
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>
static const char* socket_path = "/tmp/mysocket";
static const unsigned int s_recv_len = 200;
static const unsigned int s_send_len = 100;
const express = require('express'),
app = express(),
cors = require('cors'),
bodyParser = require('body-parser'),
delay = 100;
const fs = require('fs');
// read your a file called data
app.get('/data', function (req, res) {
@0000marcell
0000marcell / is-any-part-of-element-in-viewport.js
Created October 27, 2019 16:45
any part of the element is in the viewport
function isAnyPartOfElementInViewport(el) {
const rect = el.getBoundingClientRect();
const windowHeight = (window.innerHeight || document.documentElement.clientHeight);
const windowWidth = (window.innerWidth || document.documentElement.clientWidth);
const vertInView = (rect.top <= windowHeight) && ((rect.top + rect.height) >= 0);
const horInView = (rect.left <= windowWidth) && ((rect.left + rect.width) >= 0);
return (vertInView && horInView);
}
import Ember from 'ember';
export default Ember.Controller.extend({
showModal: Ember.computed.alias('model.showModal')
});
import Ember from 'ember';
export default Ember.Controller.extend({
queryParam: ['category'],
category: false,
actions {
filter(){
}
}
@0000marcell
0000marcell / components.pie-chart.js
Last active September 2, 2019 14:49
New Twiddle
import Ember from 'ember';
import Component from 'ember-component';
import {arc, pie} from 'd3-shape';
import { select } from 'd3-selection';
import { scaleOrdinal } from 'd3-scale';
export default Component.extend({
didInsertElement() {
this.pieChart();
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
steps: [{text: [10, 10, 'oh no, im blank']}],
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Test'
});