Skip to content

Instantly share code, notes, and snippets.

View sunny-g's full-sized avatar

Sunny Gonnabathula sunny-g

View GitHub Profile
@cmather
cmather / async.js
Created July 20, 2013 23:14
Async call from within a Meteor server side method.
if (Meteor.isServer) {
var Fiber = Npm.require('fibers');
function async (cb) {
Meteor.setTimeout(function () {
cb(null, 'hello');
}, 3000);
}
Meteor.methods({
@DavidBruant
DavidBruant / ScreenTreeNode.js
Created August 25, 2013 21:36
2D BSP in JavaScript
(function(global){
"use strict";
function constEnumPropValueDesc(v){
return {
value: v,
enumerable: true,
configurable: false,
writable: false
};
@justmoon
justmoon / send.js
Created August 29, 2013 09:33
Sending a transaction with ripple-lib
var ripple = require('ripple-lib');
// Example destination and amount
// --------------------------------------------------
var destination = "rfbKLd1VLB3o6fpkhCJexckArjoMmBm2wG";
var amount = "1/CNY/rJL724ibxVFb9EKkTe2StQ4u6ViWAQm1Wc";
// --------------------------------------------------
@justmoon
justmoon / watch.js
Created August 29, 2013 09:36
Watching for transactions with ripple-lib
var ripple = require('ripple-lib');
var remote = ripple.Remote.from_config({
// "trace" : true,
"websocket_ip" : "122.70.133.11",
"websocket_port" : 5006,
"websocket_ssl" : false
});
remote.connect();
@gabrielhpugliese
gabrielhpugliese / meteor_ytapi.js
Created September 7, 2013 21:17
Snippet for using Google Youtube APIs with Meteor rendering engine (not Meteor UI). Assume the template is called "channel". You only need to implement onPlayerReady of line 44. It uses jQuery.getScript();
Meteor.startup(function () {
Session.set('YTApiReady', false);
Session.set('channelRendered', false);
});
onYouTubeIframeAPIReady = function() {
Session.set('YTApiReady', true);
};
Template.channel.created = function () {
@travismillerweb
travismillerweb / scroll-shadow.css
Created September 23, 2013 18:57
CSS - Google Scroll Shadow
/*
Gmail/Google Reader Sidebar Scroll Shadows
-------------------------------------------
Neat effect that mimics the scroll shadows that appear in the GOogle sitde bar and visually cues users to scroll up or down depending on their position.
Credit goes to Lea Verou for this awesome find.
Source:
Lea's Talk: http://www.youtube.com/watch?v=3ikye7Qc7Ak
Code Source: http://lea.verou.me/more-css-secrets/#slide9
@petehunt
petehunt / React sortable
Created December 9, 2013 22:30
Here's an example of React + jQuery UI sortable. The key thing to note is that we have the render() method do absolutely nothing and use componentDidUpdate() + React.renderComponent() to proxy updates through to the children. This lets us manage the DOM manually but still be able to use all the React goodies you know and love.
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://fb.me/react-0.5.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
</head>
anonymous
anonymous / Makefile
Created December 15, 2013 11:58
Hedging client for Ripple
HEDGE = node riphedge
all:
npm install ripple-lib
hedge:
-while date; do \
$(HEDGE); \
sleep 100; \
done
@oubiwann
oubiwann / joes-fav.lfe
Last active July 22, 2019 21:59
Joe Armstrong's Favorite Erlang Program... in LFE
(defmodule joes-fav
(export all))
(defun universal-server ()
(receive
((tuple 'become server-function)
(funcall server-function))))
(defun factorial
((0) 1)
@XVilka
XVilka / TrueColour.md
Last active November 27, 2025 14:11
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!