Skip to content

Instantly share code, notes, and snippets.

@diverted247
diverted247 / vuejs.d.ts
Created March 15, 2014 20:06
Early Version of VueJS Type Defintion
declare var Vue: VueStatic;
interface VueObject{
}
interface VueMethods{
[n: string]: Function;
}
interface VueAttributes{
@steveluscher
steveluscher / StoriesApp.js
Last active December 2, 2015 16:26
[WIP] New Relay Tutorial App
class Comment extends React.Component {
render() {
var {comment} = this.props;
var {author} = comment;
var savePending = this.props.relay.hasOptimisticUpdate(this.props.comment);
return (
<div style={{opacity: savePending ? 0.4 : null}}>
<img src={author.avatar} width={16} /> <strong>{author.name}</strong> {comment.text}
{savePending &&
<img src="data:image/gif;base64,R0lGODlhEgASAPMAADMzMw0NDUtLS21tbY+Pj6+vr83Nzf7+/vr6+vPz8+bm5gAAAAAAAAAAAAAAAAAAACH5BAAKAAAAIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEgASAAAEjPDISauViZiDCkHXpAgDKADKhSSHMghGAZQtOBVDoRACwROZAIGCGwwMvQGgcFpSEAYjQbFyAWCsCQKhKBiyB5xCkUiACMbB8CkIBK4stPSZALgDAts24SUOqBwUOwQ6e20BBRUGPhoFXl52QjZhGlAaMV8DAQMVWR5jjiBkFzuJHQVgIQYbLawhrxURACH5BAAKAAAALAAAAAASABIAgwsLCy0tLWxsbFBQUJGRka6urs7Ozv7+/vn5+fPz8+bm5gAAAAAAAAAAAAAAAAAAAASL8Mh5EKIYo2JqIRmmDAKSDIMSHokkCIZBSso1FfA2EMSeEAHQxPAiEHkDYmBQwBgIAoIKoRAsO5SLoqCSIJ6KhMUT5WUGgfRAwuM1MegAYF2xbLsSXNg22RIKFgkyAAGAFAYfXAUFAwCMAI58TwZfHAIAJUACWTaLW4R2fFmLFpBYKwcGXTiiqF4hEQAh+Q
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
# import threading
class WebSocketsHandler(SocketServer.StreamRequestHandler):
@frankleng
frankleng / RHLclient.js
Last active August 1, 2016 19:05
Avoid RR warning in RHL 3.0
const createRoutes = require('../routes/root').default;
const routes = createRoutes(store);
const render = () => {
const { pathname, search, hash } = window.location;
return match({ routes, location: `${pathname}${search}${hash}` }, () => {
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<Router
@jakejscott
jakejscott / server.go
Created May 20, 2014 00:53
negroni + httprouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
@shantanuo
shantanuo / tokudb_copy.sh
Created January 26, 2014 15:12
Copy toku database to another server without using dump
#!/bin/sh
# copy the database source files to destination
dbname='palus'
source='/DATA/4GLV/tokudb/'
destip='192.168.150.137'
destuser='db'
destpass='db'
destport='3306'
import { action } from 'common/utils/redux/redux';
@action
export class Actions {
static types = {
set3d: Symbol('set3d')
};
static set3d(val) {
@tgecho
tgecho / Directional React Animations.markdown
Last active April 16, 2018 12:40
Directional React Animations

Directional React Animations

This is a demo of dynamic directional transitions using React's CSSTransitionGroup.

A Pen by tgecho on CodePen.

License.

@balupton
balupton / README.md
Last active September 29, 2018 18:31
Responsive layouts in stylus

Responsive layouts in stylus

Why this way?

  1. There is no span1..15 styles, instead your css defines your layout and your html remains semantic and not polluted with display information. As it should be.

  2. The markup is incredibly easy, you specify the wrappers width, and then each columns width in percentages. Every other grid framework I've found is incredibly complicated with this.

  3. It allows you to have the exact same markup, and completely different styles for different devices, resolutions, stylesheets, whatever. As it should be.

@edhemphill
edhemphill / texample.cpp
Created February 28, 2012 22:43
C++ threaded extension for node.js w/ gyp build
// Originally at:
// http://bravenewmethod.wordpress.com/2011/03/30/callbacks-from-threaded-node-js-c-extension/
#include <queue>
// node headers
#include <v8.h>
#include <node.h>
#include <ev.h>
#include <pthread.h>