Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
Router.map(function () {
this.route('index', {
controller: 'BasicController',
layoutTemplate: 'indexLayout',
path: '/',
waitOn: function () {
return Meteor.subscribe('Channels');
}
});
Meteor.startup(function () {
Session.set('YTApiReady', false);
Session.set('channelRendered', false);
});
onYouTubeIframeAPIReady = function() {
Session.set('YTApiReady', true);
};
Template.channel.created = function () {
Mesosphere.registerRule('checkDate', function (fieldValue, ruleValue) {
console.log('checkDate')
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
gregorynicholas / show-user-selection.js
Created February 20, 2014 23:51
hack attempt at a script to only display text in a user selection range
a.ondrag = function(e){
var text = "";
if (typeof window.getSelection != "undefined") {
var sel = window.getSelection();
if (sel.anchorNode && sel.anchorNode.id && sel.anchorNode.id !== 'message') {
console.info('--- sel.anchorNode.id:', sel.anchorNode.id);
// 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.

Template.assetUpload.events(
'drop #asset-upload-dropzone': (e) ->
e.stop()
$(e.target).removeClass 'dropzone-hover'
new AssetUpload(e)
'dragenter #asset-upload-dropzone': (e) ->
e.stop()
$(e.target).addClass 'dropzone-hover'
## RubyMotion
imageData = UIImage.UIImageJPEGRepresentation(@image_view.image, 1)
encodedData = [imageData].pack("m0")
data["image"] = encodedData
BW::HTTP.post("http://localhost:3000/upload}", {payload: data}) do |response|
if response.ok?
end
end
@gregorynicholas
gregorynicholas / colors
Last active August 29, 2015 14:21 — forked from twerth/colors
#!/bin/bash
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"
#!/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 = words.select {|w| /^#{Regexp.escape prefix}/ =~ w} if prefix