Skip to content

Instantly share code, notes, and snippets.

🎯
Busy building apps people love ❤️

Anenth Anenth

🎯
Busy building apps people love ❤️
Block or report user

Report or block Anenth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Anenth
Anenth / Simple data watcher.js
Created Dec 18, 2018
A simple pub/sub model - `set data()` - whenever this.data is changed the `set data()` gets called
View Simple data watcher.js
function Store(initialData, options = {}) {
const handlers = [];
let nextHandlerId = 0;
return {
get data() {
return initialData;
},
set data(t) {
console.log("Set was called");
@Anenth
Anenth / Arraymultiple.js
Created Nov 14, 2018
Array multiple with prototype
View Arraymultiple.js
Array.prototype.multiply = function(){
const le = this.length;
for(let i=0; i < le; i++){
this[i+le] = this[i]*this[i];
console.log(this)
}
};
const a = [1, 2, 3, 4, 5];
a.multiply();
@Anenth
Anenth / cancellable_promise-bluebird.js
Created Dec 11, 2017
Cancellable promise with bluebird
View cancellable_promise-bluebird.js
import Promise from 'Bluebird';
function updateUser() {
return new Promise((resolve, reject, onCancel) => {
let cancelled = false;
// you need to config Bluebird to have cancellation
// http://bluebirdjs.com/docs/api/promise.config.html
onCancel(() => {
cancelled = true;
View cancellable_promise.js
export const CancellablePromise = (promise) => {
let isCancelled = false;
const wrappedPromise = new Promise((resolve, reject) => {
promise.then(
(...args) => (isCancelled ? reject('cancelled') : resolve(...args)),
error => (isCancelled ? reject('cancelled') : reject(error)),
);
});
@Anenth
Anenth / 0_reuse_code.js
Created Sep 3, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Anenth
Anenth / config.json
Created Jul 29, 2017 — forked from anonymous/config.json
Bootstrap Customizer Config
View config.json
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
View rboxtimeline.json
[{"pid":53245,"tid":1295,"ts":345821666954,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../components/scheduler/base/task_queue_impl.cc","src_func":"PushOntoImmediateIncomingQueueLocked"},"dur":27857,"tdur":635,"tts":5745664},
{"pid":53245,"tid":1295,"ts":345821687212,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":7550,"tdur":316,"tts":5745925},
{"pid":53245,"tid":1295,"ts":345821694770,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":21,"tdur":18,"tts":5746260},
{"pid":53245,"tid":1295,"ts":345821694792,"ph":"X","cat":"toplevel","name":"TaskQueueManager::ProcessTaskFromWorkQueue","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":7,"tdur":5,"tts":5746282},
{"pid":53245,"tid":1295,"ts":345821694800,"ph":"X",
@Anenth
Anenth / atjs.less
Last active Aug 29, 2015
At.js bootstrap style
View atjs.less
.atwho-view {
top: 0;
left: 0;
position: absolute;
display: none;
overflow: auto;
ul {
&:extend(.dropdown-menu);
position: relative;
View preference
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/User/base16-eighties.dark (SL).tmTheme",
"detect_indentation": false,
"draw_white_space": "selection",
"folder_exclude_patterns":
[
".svn",
@Anenth
Anenth / Utils.scss
Last active Aug 29, 2015
Useful Sass mixins
View Utils.scss
// 1. BEM Mixin
@mixin e($name) {
@at-root &__#{$name} {
@content;
}
}
//modifiers get appended with "--" and the $name
@mixin m($name) {
@at-root &--#{$name} {
You can’t perform that action at this time.