Skip to content

Instantly share code, notes, and snippets.

View chamnap's full-sized avatar

Chamnap Chhorn chamnap

View GitHub Profile
Email: 982092332@qq.com
SN: GAWAE-FCWQ3-P8NYB-C7GF7-NEDRT-Q5DTB-MFZG6-6NEQC-CRMUD-8MZ2K-66SRB-SU8EW-EDLZ9-TGH3S-8SGA
@ipepe
ipepe / install-chrome-headless.sh
Last active April 19, 2024 07:15
Installing headless chrome on Ubuntu.
#!/bin/bash
# from https://chromium.woolyss.com/
# and https://gist.github.com/addyosmani/5336747
# and https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:canonical-chromium-builds/stage
sudo apt-get update
sudo apt-get install chromium-browser
chromium-browser --headless --no-sandbox http://example.org/
@anlek
anlek / application.scss
Last active April 30, 2020 13:51
My current work around for simple_form and Bootstrap 4 beta to work together (till simple_form allows input fields to have `is-invalid` set on it on error - see https://github.com/plataformatec/simple_form/pull/1476)
// Fix for validations on simple form
// Need to import bootstrap functions and mixins if you want to dynamically set colors
// Otherwise replace theme-color... with hex color
@import 'bootstrap/functions';
@import 'bootstrap/variables';
@import 'bootstrap/mixins';
.has-invalid {
.invalid-feedback {
@TomTasche
TomTasche / nginx.conf
Last active January 27, 2023 21:22
config for nginx to proxy a specific path to an S3 bucket
# copied from default config
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@johanndt
johanndt / upgrade-postgres-9.3-to-9.5.md
Last active July 15, 2022 12:35 — forked from dideler/upgrade-postgres-9.3-to-9.4.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
@carlesso
carlesso / phantomtumblr.js
Last active March 15, 2016 04:01
Phantom Tumblr https error
var page = require('webpage').create();
var system = require('system');
page.onResourceRequested = function (request) {
system.stderr.writeLine('= onResourceRequested()');
system.stderr.writeLine(' request: ' + JSON.stringify(request, undefined, 4));
};
page.onResourceReceived = function(response) {
system.stderr.writeLine('= onResourceReceived()' );
@henrik
henrik / month.rb
Last active January 12, 2018 22:31
Ruby Month class.
require "attr_extras" # gem
class Month
vattr_initialize :year, :month_number
def self.from(object)
case object
when Month then object
else new(object.year, object.month)
end
@julionc
julionc / 00.howto_install_phantomjs.md
Last active February 21, 2024 11:01
How to install PhantomJS on Debian/Ubuntu

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
@orbanbotond
orbanbotond / mongoid_observers.rb
Created November 6, 2013 15:03
mongoid observers
module MyObservers
module Document
module ClassMethods
def observers= (*observers)
declared_observers.replace(observers.flatten)
end
def declared_observers
@declared_observers ||= []
end
@FokkeZB
FokkeZB / README.md
Created September 20, 2013 09:38
URL schemes for iOS and Android (2/2)