Skip to content

Instantly share code, notes, and snippets.

View eduardonunesp's full-sized avatar
🐚

Eduardo Pereira eduardonunesp

🐚
View GitHub Profile
@denkiwakame
denkiwakame / gist:c665e50c85eb4edbd055
Created January 5, 2015 13:22
getline for split
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
std::vector<std::string> split(const std::string& input, char delimiter)
{
std::istringstream stream(input);
std::string field;
import urllib
print 'javascript:' + urllib.quote("""
(function(){
var e = document.createElement('script');
e.src='/boot.js';
e.type='text/javascript';
document.getElementsByTagName('body')[0].appendChild(e);})()
""".strip().replace('\n', ' '))
package main
import (
"bufio"
"fmt"
"net"
)
type Client struct {
incoming chan string
@johannes-weber
johannes-weber / ValidateFloat.js
Last active January 24, 2016 10:35
AngularJS Custom Float Validation
'use strict';
/**
* This directive parses both 1.2 and 1,2 into a valid float number 1.2.
* Note that you can't use input type number here as HTML5 browsers would
* not allow the user to type what it would consider an invalid number such as 1,2.
*
* <input ng-model="{yourModel}" validate-float />
*/
angular.module('Library').directive('validateFloat', function () {
JSCLASS_PATH = 'build/min';
require('./' + JSCLASS_PATH + '/loader');
JS.require('JS.Deferrable');
Promise = new JS.Class({
include: JS.Deferrable,
initialize: function(value) {
if (value !== undefined) this.succeed(value);
@tobiash
tobiash / qredis.coffee
Created June 6, 2012 20:30
Q + node_redis
# Applies Q.nbind to all redis operations and returns a wrapped client
_ = require("underscore")._
Q = require "q"
nbindOps = (client) ->
functions = _.functions client
# All the ops are available as upper/lowercase functions, I exploit this
# to filter out the Redis operations from the other functions of the client
#
@imyourm8
imyourm8 / bip39-loom.cs
Last active June 20, 2018 09:56
Generate Private Key for Loom Using BIP39
// Add this function to Loom SDK CryptoUtils.cs
public static byte[] GeneratePrivateKey(byte[] seed) {
byte[] publicKey32;
byte[] privateKey64;
Ed25519.KeyPairFromSeed(out publicKey32, out privateKey64, seed);
return privateKey64;
}
// You can use any BIP39 implementation. In this example i used https://github.com/ByronAP/BIP39.NET-Portable
var mnemonic = "spin sunset pact nature enhance include fatigue occur blind wire inner foot";
@jonah-williams
jonah-williams / circle.yml
Last active May 29, 2019 14:53
Automating deployments to Heroku from CircleCI
test:
override:
- bundle exec rspec spec
deployment:
acceptance:
branch: master
commands:
- ./script/heroku_deploy.sh <ACCEPTANCE_HEROKU_APP>:
timeout: 300
@4poc
4poc / gist:3155832
Created July 21, 2012 13:30
C++11 Callbacks with function and lambda
#include <iostream>
#include <vector>
#include <functional>
class WorkingClass {
public:
typedef const std::function<void (int)> handler_t;
void AddHandler(handler_t& h) {
handlerList.push_back(&h);
}
@douglasmiranda
douglasmiranda / 1ntro.markdown
Last active January 13, 2020 03:28
Django + git + apache mod_wsgi na Kinghost

#Django + git + apache mod_wsgi na Kinghost

NOTE: Atualmente não é necessário tanto para fazer deploy de aplicações Django na Kinghost.

I hope you like it!

##Início

Talvez você não queira ficar digitando a senha toda vez que usar o ssh, então adicione sua chave pública ao seu host: