Skip to content

Instantly share code, notes, and snippets.

@bellbind
bellbind / bigint.js
Created November 24, 2011 10:06
[javascript]clear big integer implementation
// clear Big Integer implementation of JavaScript/ECMAScript5
// BigDecimal(10**n base): for string conversion
// - BigInt and BigDecimal are basically same.
var BigDecimal = this.BigDecimal = function (ints, sign) {
var ctor = BigDecimal;
ints = ints || [];
sign = ctor.normalize(ints, sign || 1);
return Object.freeze(Object.create(ctor.prototype, {
ints: {value: Object.freeze(ints), enumerable: true},
@tony4d
tony4d / p4merge4git.md
Created August 24, 2012 19:00
Setup p4merge as a visual diff and merge tool for git
@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@rjmackay
rjmackay / main.js
Created June 12, 2013 01:10
Mapbox + requirejs example
requirejs.config({
shim: {
'http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.js': {
exports: 'L'
}
}
});
require(["http://api.tiles.mapbox.com/mapbox.js/v1.0.2/mapbox.js"], function(mapbox) {
@Wu-Wu
Wu-Wu / haproxy.conf
Created June 29, 2013 14:44
HAProxy configuration to deploy PSGI application
#
# application entry points
# https://www.example.com/ (production)
# https://demo.example.com/ (demo/lite production)
# https://devel.example.com/ (development)
#
# static content served by nginx server
# http://app-be1.example.net:4xxx/
# http://app-be2.example.net:4xxx/
#
@rotexdegba
rotexdegba / dropdown-list-in-a-cell-phpexcel.php
Created November 21, 2013 18:25
How to add drop down list to a cell in PHPExcel
<?php
$objValidation = $objPHPExcel->getActiveSheet()->getCell("C$curr_row")->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');
@demisx
demisx / angularjs-providers-explained.md
Last active May 17, 2024 03:38
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@garystafford
garystafford / helpful-docker-commands.sh
Last active July 1, 2024 06:57
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@obolton
obolton / elb-nodejs-ws.md
Last active November 12, 2023 11:49
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer