Skip to content

Instantly share code, notes, and snippets.

View akhoury's full-sized avatar
🏠
Working from home

Aziz Khoury akhoury

🏠
Working from home
View GitHub Profile
@akhoury
akhoury / npm-mod-install-fail.js
Last active August 29, 2015 14:05
node v0.10.3, npm v1.4.4 A test script to install module via npm, that when attempting to uninstall a module (which was installed from the npm registry) then installing the same module from a URL (github.com), the 2nd call to require attempts to execute the old main script which does not execute, even after clearing require's cache.
var fs = require('fs');
var getModuleShortName = function(giturlORname) {
if (giturlORname.indexOf('git://github.com') > -1) {
return giturlORname.split('/').pop().split('#')[0];
}
return giturlORname.split('@')[0];
};
var searchModulesCache = function(moduleName, callback) {
var npm = require('npm');
var fs = require('fs');
var path = require('path');
module.constructor.new_packageMainCache = {}; // own cache
// copied from node src
function statPath(path) {
try {
var isNumber = function(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
var getStorage = function(key) {
var data = localStorage.getItem(key),
ttl = localStorage.getItem(key + '-ttl'),
expired = ttl == null ? false : ttl < (new Date()).getTime();
This file has been truncated, but you can view the full file.
[nodebb-plugin-import] importer.success Importing 5000 topics.
isUserAllowedTo topics:create 1049 [ '2' ]
isGuestAllowedTo topics:create [ '2' ]
isGuestAllowedTo:result topics:create [ '2' ] result: true
privileges.categories.can=topics:create cid=2 uid=2 result=true
isUserAllowedTo topics:create 904 [ '2' ]
isUserAllowedTo:result topics:create 1049 [ '2' ] result:false
privileges.categories.can=topics:create cid=2 uid=2 result=false
isGuestAllowedTo topics:create [ '2' ]
isUserAllowedTo:result topics:create 904 [ '2' ] result:false
@akhoury
akhoury / robots
Last active August 29, 2015 14:11
robots.text to disallow all engines
User-agent: *
Disallow: /
var convert = require('./bbcode-to-markdown');
var testString = '[As always, if anyone, especially ENFPs, has any suggestions for changes or improvements, feel free to comment.]' +
'[SIZE="5"]ENFP: A Jungian Cognitive Function Analysis[/SIZE]' +
'[SIZE="3"]by simulatedworld[/SIZE]' +
'[URL="www.personalitynation.com"]www.personalitynation.com[/URL]' +
'[B]ENFP[/B], or [I]Extroverted iNtuitive Feeling Perceiver[/I], is a label borrowed from MBTI nomenclature and now applied to the Jungian Cognitive Function set [B]{Ne, Fi, Te, Si}[/B].' +
'[B]Dominant: Extroverted iNtuition (Ne)[/B]' +
'[I]"More than anything I need to feel like I\'m working toward some kind of meaningful change or improvement in people\'s lives. I have a lot of big ideas for making things better, and I get really excited about new ideas that point toward some kind of new direction or idea I hadn\'t thought of before. I usually try to have a lot of people I like around, both because I like having them to bounce my ideas
@akhoury
akhoury / gc2r.js
Last active August 29, 2015 14:13
// won't work, im dumb, I just realized that it's a cross-domain frame, initially I thought the frame-content is being written by the js script
var gc2r = (function() {
var hostPageStyle = ''
+ '@media screen and (max-width: 350px) {'
+ ' div.goog-bubble-content.gc-reset {'
+ ' width: auto !important;'
+ ' }'
+ ' div.goog-bubble-content.gc-reset, '
/*
example:
// [1,2,3,4,5,6,7,8] (must be a power of 2 length)
var arr = new Foldable([1, 2, 3, 4, 5, 6, 7, 8]);
arr.fold( [ "l", "r", "l" ] ); // left, right, left
// left
@akhoury
akhoury / augment.js
Last active December 21, 2015 14:48
augment a function
var augment = function (base, extra, context) {
return (function () {
return function () {
base.apply(context || this, arguments);
extra.apply(context || this, arguments);
};
})();
};
// usage
@akhoury
akhoury / augment.coffee
Created August 23, 2013 17:29
augment.coffee
augment = (base, extra, context) ->
(->
->
base.apply context or this, arguments_
extra.apply context or this, arguments_
)()