Skip to content

Instantly share code, notes, and snippets.

View charleslouis's full-sized avatar

okcharlo charleslouis

View GitHub Profile
const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(url) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required.
const pdfConfig = {
path: 'url.pdf', // Saves pdf to disk.
format: 'A4',
@ulhas
ulhas / entrypoint.sh
Created April 11, 2017 04:45
Script to run when spinning up SailsJS container
#!/bin/bash
set -e
cmd="$@"
export REDIS_URL=redis://redis:6379
# the official postgres image uses 'postgres' as default user if not set explictly.
if [ -z "$POSTGRES_USER" ]; then
export POSTGRES_USER=postgres
fi
@ulhas
ulhas / Dockerfile
Created April 9, 2017 20:33
Docker file for SailsJS app
FROM node:latest
RUN npm install -g sails grunt npm-check-updates
COPY ./package.json /package.json
RUN npm install
RUN npm install --save sails-postgresql@beta
COPY ./compose/sails/entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r//' /entrypoint.sh
@ulhas
ulhas / docker-compose.yml
Created April 9, 2017 20:32
Docker compose file for SailsJS app
version: '2'
volumes:
postgres_data_dev: {}
postgres_backup_dev: {}
services:
postgres:
build: ./compose/postgres
volumes:
@schalkburger
schalkburger / sage_favicons.php
Last active January 16, 2020 01:33
Roots Sage Favicons
/**
* Load favicons
* Place icons in the theme images directory. Want more? http://realfavicongenerator.net/
*/
function sage_favicons() {
echo '<link rel="apple-touch-icon" sizes="57x57" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-57x57.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="60x60" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-60x60.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="72x72" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-72x72.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="76x76" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-76x76.png">';echo "\n";
echo '<link rel="apple-touch-icon" sizes="114x114" href="'. get_template_directory_uri() .'/dist/images/apple-touch-icon-114x114.png">';echo "\n";
@ssgonchar
ssgonchar / installer_.stylelintrc
Created April 19, 2016 11:15
Install and run: jshint, jslint, jscs, stylehint, htmlhint.
{
"rules": {
"at-rule-empty-line-before": "always"|"never",
"at-rule-name-case": "lower"|"upper",
"at-rule-no-vendor-prefix": true,
"at-rule-semicolon-newline-after": "always",
"block-closing-brace-newline-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-closing-brace-newline-before": "always"|"always-multi-line"|"never-multi-line",
"block-closing-brace-space-after": "always"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
"block-closing-brace-space-before": "always"|"never"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line",
@mathpere
mathpere / config.json
Created November 18, 2014 18:35
PayZen with NodeJS
{
"payZen": {
"url": "https://secure.payzen.eu/vads-payment/",
"certificat": "XXXXXXXXX",
"vads_site_id": "YYYYYYYY",
"vads_version": "V2",
"vads_ctx_mode": "TEST"
}
}
@pricejn2
pricejn2 / gandi_simple_hosting_drush.sh
Created June 18, 2014 16:37
Gandi Simple Hosting Drush install
cd tmp
wget https://github.com/drush-ops/drush/archive/6.3.0.zip
unzip 6.3.0.zip
rm -rf 6.3.0.zip
mv drush-6.3.0 ~/var/php/admin/
cd ~/var/php/admin/
mv drush-6.3.0 drush
chmod 755 drush/drush
chmod 755 drush/drush.php
nano ~/etc/bash/bashrc
@KonradIT
KonradIT / readme.md
Last active July 11, 2024 20:46
GoPro Studio for Linux
@chatman-media
chatman-media / angular-pushstate-support.md
Last active May 30, 2020 05:06
Using grunt and Angular with pushstate support!
title author layout categories
Using grunt and angular with pushstate support
Blackjid
post
grunt
angularjs
yeoman