Skip to content

Instantly share code, notes, and snippets.

View sharavsambuu's full-sized avatar
🐌

sharavsambuu sharavsambuu

🐌
View GitHub Profile
@sharavsambuu
sharavsambuu / mp3.js
Created February 24, 2014 07:07 — forked from dtrce/mp3.js
var http = require('http'),
fileSystem = require('fs'),
path = require('path')
util = require('util');
http.createServer(function(request, response) {
var filePath = 'path_to_file.mp3';
var stat = fileSystem.statSync(filePath);
response.writeHead(200, {
(function (window, document, $, undefined) {
var possibleCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var defaults = {
selector: "#captcha",
text: null,
randomText: true,
randomColours: true,

Migrate

$ ./node_modules/.bin/knex:migrate:latest -c db/config.js

SSL upgrades on rubygems.org and RubyInstaller versions

Hello,

If you reached this page, means you've hit this SSL error when trying to pull updates from RubyGems:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

This error is produced by changes in rubygems.org infrastructure, please

@sharavsambuu
sharavsambuu / initializer-session.js
Created December 26, 2015 12:40
Authentication with Firebase and Ember.js
/*
* Working authentication with
* Firebase 2.0.x + Ember.js 1.8.1 + Ember Data Canary + EmberFire 1.3.0 + Ember CLI
* works for me! oskar@rough.dk
*
* Note: this assumes you've set up login on your Firebase,
* only handles Google and Facebook for now,
*
* In your templates: <button {{action 'login' 'google'}}>Log in with Google</button>
*/
@sharavsambuu
sharavsambuu / longPolling.js
Created March 5, 2016 07:32 — forked from jasdeepkhalsa/longPolling.js
Simple Long Polling Example with JavaScript and jQuery by Tian Davis (@tiandavis) from Techoctave.com (http://techoctave.com/c7/posts/60-simple-long-polling-example-with-javascript-and-jquery)
// Long Polling (Recommened Technique - Creates An Open Connection To Server ∴ Fast)
(function poll(){
$.ajax({ url: "server", success: function(data){
//Update your dashboard gauge
salesGauge.setValue(data.value);
}, dataType: "json", complete: poll, timeout: 30000 });
})();
@sharavsambuu
sharavsambuu / app_controllers_sign-in.js
Created April 5, 2016 10:05 — forked from code0100fun/app_controllers_sign-in.js
Ember Simple AUth + Ember CLI Mirage
// app/controllers/sign-in.js
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
signIn(){
this.set('errors', null);
var params = { identification: this.get('email'), password: this.get('password') };
// Redirects to index route on success (configurable in config/environment.js)
this.get('session').authenticate('simple-auth-authenticator:oauth2-password-grant', params);
@sharavsambuu
sharavsambuu / yourapp
Created May 25, 2016 08:20 — forked from leplatrem/yourapp
gunicorn virtualenv init.d script (could be simpler with upstart)
#! /bin/bash
### BEGIN INIT INFO
# Provides: yourapp
# Required-Start: nginx
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The main django process
# Description: The gunicorn process that receives HTTP requests
# from nginx