Skip to content

Instantly share code, notes, and snippets.


gregory nicholas gregorynicholas

View GitHub Profile
View coderstv-router.js () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
View meteor_ytapi.js
Meteor.startup(function () {
Session.set('YTApiReady', false);
Session.set('channelRendered', false);
onYouTubeIframeAPIReady = function() {
Session.set('YTApiReady', true);
}; = function () {
View mesosphere.js
Mesosphere.registerRule('checkDate', function (fieldValue, ruleValue) {
if (!ruleValue) {
return true;
var date = fieldValue.split('-'),
today = new Date((new Date()).setHours(0, 0, 0, 0));
date = new Date(date[0], date[1] - 1, date[2]);
gregorynicholas / show-user-selection.js
Created Feb 20, 2014
hack attempt at a script to only display text in a user selection range
View show-user-selection.js
a.ondrag = function(e){
var text = "";
if (typeof window.getSelection != "undefined") {
var sel = window.getSelection();
if (sel.anchorNode && && !== 'message') {'---',;
// return true;
def _init():
import atexit
import os
import sys
import readline
import types
import time
import uuid
import pprint
import hashlib

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

'drop #asset-upload-dropzone': (e) ->
$( 'dropzone-hover'
new AssetUpload(e)
'dragenter #asset-upload-dropzone': (e) ->
$( 'dropzone-hover'
View gist:68e345aa2a56859b8cf4
## RubyMotion
imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1)
encodedData = [imageData].pack("m0")
data["image"] = encodedData"http://localhost:3000/upload}", {payload: data}) do |response|
if response.ok?
View colors
echo -e "\033[0mCOLOR_NC (No color)"
echo -e "\033[1;37mCOLOR_WHITE\t\033[0;30mCOLOR_BLACK"
echo -e "\033[0;34mCOLOR_BLUE\t\033[1;34mCOLOR_LIGHT_BLUE"
echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN"
echo -e "\033[0;36mCOLOR_CYAN\t\033[1;36mCOLOR_LIGHT_CYAN"
echo -e "\033[0;31mCOLOR_RED\t\033[1;31mCOLOR_LIGHT_RED"
echo -e "\033[0;35mCOLOR_PURPLE\t\033[1;35mCOLOR_LIGHT_PURPLE"
echo -e "\033[0;33mCOLOR_YELLOW\t\033[1;33mCOLOR_LIGHT_YELLOW"
View gist:08a9c5624984ec7e0049
#!/usr/bin/env ruby
# To use, put this in your bashrc:
# complete -C path/to/script -o default your_command_or_commands_here
# example, to complete the foo and bar commands with the foo.rb script: complete -C ~/bin/foo.rb -o default foo bar
prefix = ARGV[1]
words = `some command here, or just any array`.split.uniq
words = {|w| /^#{Regexp.escape prefix}/ =~ w} if prefix
You can’t perform that action at this time.