Skip to content

Instantly share code, notes, and snippets.

View JulianLaval's full-sized avatar
🎯
Focusing

Julian Laval JulianLaval

🎯
Focusing
View GitHub Profile
[
{ code: 'AD', label: 'Andorra', phone: '376', phoneLength: 6},
{ code: 'AE', label: 'United Arab Emirates', phone: '971', phoneLength: 9},
{ code: 'AF', label: 'Afghanistan', phone: '93', phoneLength: 9},
{ code: 'AG', label: 'Antigua and Barbuda', phone: '1-268', phoneLength: 10},
{ code: 'AI', label: 'Anguilla', phone: '1-264', phoneLength: 10},
{ code: 'AL', label: 'Albania', phone: '355', phoneLength: 9},
{ code: 'AM', label: 'Armenia', phone: '374', phoneLength: 6},
{ code: 'AO', label: 'Angola', phone: '244', phoneLength: 9},
{ code: 'AQ', label: 'Antarctica', phone: '672', phoneLength: 6},
@tony-gutierrez
tony-gutierrez / aws_eb_cron.js
Last active October 11, 2023 02:59
AWS Elastic Beanstalk master instance nodejs cron.
const logger = require('./logger'),
AWS = require('aws-sdk'),
CronJob = require('cron').CronJob;
AWS.config.update({region: 'us-east-1'}); // change to your region
var opts = {
credentials: new AWS.EC2MetadataCredentials()// default to use the credentials for the ec2 instance
};
var elasticbeanstalk = new AWS.ElasticBeanstalk(opts);
@clarkenheim
clarkenheim / mongodb_distinct_count.js
Last active December 12, 2023 09:22
MongoDB equivalent of an SQL query to get the distinct values of a field in a collection including the count of documents which have each distinct value (distinct with count)
//equivalent of MySQL SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName;
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}]);
//as above but ordered by the count descending
//eg: SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName ORDER BY cnt DESC;
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}, {$sort:{'cnt':-1}}]);
@designbyadrian
designbyadrian / Console.log() override.js
Created August 18, 2014 14:41
Hijack console.log, console.warn, and console.error without breaking the default browser function.
var cl,ce,cw;
if(window.console && console.log){
cl = console.log;
console.log = function(){
MyLogFunction(arguments);
cl.apply(this, arguments)
}
}
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@dannycroft
dannycroft / exclude-node-modules
Last active February 27, 2019 18:25
Exclude node_modules out of Sublime Text 2 searches
// Add the following to your preferences file
"folder_exclude_patterns":[".git","node_modules"]
@umpirsky
umpirsky / A.markdown
Last active August 3, 2023 18:14 — forked from olivierlacan/An_example.markdown
Sublime Text Monokai Sidebar Theme.
@kitek
kitek / gist:1579117
Created January 8, 2012 17:50
NodeJS create md5 hash from string
var data = "do shash'owania";
var crypto = require('crypto');
crypto.createHash('md5').update(data).digest("hex");
@irae
irae / _Stay_standalone.md
Last active January 29, 2024 12:38 — forked from kylebarrow/example.html
Stay Standalone: Prevent links in standalone web apps opening Mobile Safari

#Stay Standalone

A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.