This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var interv = setInterval((function() { | |
| console.log('DING DING DING'); | |
| return arguments.callee; | |
| })(), 2000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- For iPhone 4 with high-resolution Retina display: --> | |
| <link rel="apple-touch-icon-precomposed" sizes="114x114" href="apple-touch-icon-114x114-precomposed.png"> | |
| <!-- For first-generation iPad: --> | |
| <link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png"> | |
| <!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: --> | |
| <link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # "stop, hammertime".rot13() // returns "fgbc, unzzregvzr" | |
| # "fgbc, unzzregvzr".rot13() // returns "stop, hammertime" | |
| String::rot13 = -> | |
| this.replace /[a-zA-Z]/g, (c) -> | |
| String.fromCharCode (if ((if c <= "Z" then 90 else 122)) >= (c = c.charCodeAt(0) + 13) then c else c - 26) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var KEYS = { | |
| enter: 13, | |
| left: 37, | |
| right: 39, | |
| escape: 27, | |
| backspace: 8, | |
| comma: 188, | |
| shift: 16, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var zlib = require('zlib'); | |
| var redis = require('redis'); | |
| var redisClient = redis.createClient(); | |
| var crypto = require('crypto'); | |
| // Our custom caching write function | |
| function cached(body, lifetime, type) { | |
| var key = this.req.originalUrl; | |
| var res = this; | |
| var etag, len; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| eventsource "github.com/antage/eventsource/http" | |
| redis "github.com/vmihailenco/redis" | |
| "log" | |
| "net/http" | |
| ) | |
| func haltOnErr(err error){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from geventwebsocket.handler import WebSocketHandler | |
| from gevent.pywsgi import WSGIServer | |
| from flask import Flask, request, render_template | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return render_template('index.html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| function ask_gpt() { | |
| PROMPT=$(gum input --width 80 --placeholder "prompt") | |
| if [[ -z "$PROMPT" ]]; then | |
| exit 0 | |
| fi | |
| gum style --foreground 212 "> $PROMPT" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MongoEncoder(json.JSONEncoder): | |
| def _iterencode(self, o, markers=None): | |
| if isinstance(o, ObjectId): | |
| return str(o) | |
| else: | |
| return json.JSONEncoder._iterencode(self, o, markers) | |
| def smart_json_response(data): | |
| data = json.dumps(data, cls = MongoEncoder, indent=4) | |
| return current_app.response_class(data, mimetype='application/json') |
OlderNewer