Skip to content

Instantly share code, notes, and snippets.

View eloone's full-sized avatar
👀
echo $?

✨Eloone eloone

👀
echo $?
View GitHub Profile
@AndrewRayCode
AndrewRayCode / gist:825583
Created February 14, 2011 07:15
recursive read directory in node.js returning flattened list of files and directories
function readDir(start, callback) {
// Use lstat to resolve symlink if we are passed a symlink
fs.lstat(start, function(err, stat) {
if(err) {
return callback(err);
}
var found = {dirs: [], files: []},
total = 0,
processed = 0;
function isDir(abspath) {
@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@BPScott
BPScott / readme.md
Last active February 7, 2024 16:16
Github suggestion: Per-organization email overrides

This totally happened, y'all can stop +1ing this now. GitHub Blog post. Direct link to settings where you can set this.


#Per-organization / per-repo email overrides - A feature suggestion

Here the concepts "organization" and "user" are interchangeable, I'm talking about an entity that owns a repo, whether it is jQuery or John Resig. I'll stick to using organization as it best represents my original use-case.

##TL;DR

@carlosmcevilly
carlosmcevilly / gist:2221249
Created March 27, 2012 22:55
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
@ecmendenhall
ecmendenhall / jasmine_chrome_tests.md
Created September 18, 2012 02:17
Integrating the Jasmine test runner for Chrome extension development

[Jasmine][jas] is an excellent framework for JavaScript testing, but I had a tough time coaxing it into cooperation with the Chrome extension I was developing. Jasmine's default testrunner uses an inline script block that listens for window.onload to setup the test environment, but Chrome prohibits extensions from running inline code. Alas, it's not as easy as importing the inline code as a separate file. After a little tinkering, this is what I came up with:

Extension
    ├── html
    ├── js 
    ├── manifest.json
    └── tests
        ├── jasmine
        │   └── lib

│   └── jasmine-1.2.0

@jpic
jpic / alarm.sh
Created February 12, 2013 09:07
Alarm script proof of concept that works even if your computer is in hibernation.
#!/bin/bash
set -x
MUSIC=(~/Music/Africando\ -\ All\ Stars\ Betece/*mp3)
START="$(date +%s -d 'tomorrow 08:00')"
#START="$(date '+%s' -d '+ 5 minutes')"
STOP="$(date '+%s' -d 'tomorrow 19:00')"
sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"
sudo sh -c "echo $START > /sys/class/rtc/rtc0/wakealarm"
@rafali
rafali / BackgroundTransitionView.java
Last active September 16, 2017 09:51
Background transition on Android
TransitionDrawable transition = (TransitionDrawable) view.getBackground();
if (toggle) {
view.startTransition(1200);
} else {
view.reverseTransition(1200);
}
@ondrej-kvasnovsky
ondrej-kvasnovsky / oauth.js
Last active October 18, 2021 22:39
How to login with GitHub account and add the GitHub credentials to existing user account
isProdEnv = function () {
if (process.env.ROOT_URL == "http://localhost:3000") {
return false;
} else {
return true;
}
}
Accounts.loginServiceConfiguration.remove({
service: 'google'
@eloone
eloone / binaryInsert.js
Last active June 22, 2019 15:43
Binary Insert
/**
* Example :
* var a = [2,7,9];
* binaryInsert(8, a);
*
* It will output a = [2,7,8,9]
*
*/
function binaryInsert(value, array, startVal, endVal){
@sararob
sararob / data-structure.js
Last active April 26, 2022 22:21
Role-based security in Firebase
/*
This example shows how you can use your data structure as a basis for
your Firebase security rules to implement role-based security. We store
each user by their Twitter uid, and use the following simplistic approach
for user roles:
0 - GUEST
10 - USER
20 - MODERATOR