Skip to content

Instantly share code, notes, and snippets.

@venblee
venblee / Select 2 Val or Text
Created June 21, 2013 18:01
Get Value or Text from Select2
var test = $('#test');
$(test).select2({
data:[
{id:0,text:"enhancement"},
{id:1,text:"bug"},
{id:2,text:"duplicate"},
{id:3,text:"invalid"},
{id:4,text:"wontfix"}
],
width: "300px"
@hubgit
hubgit / README.md
Last active March 23, 2024 19:12
A5 printed card with HTML + CSS
  1. Clone this Gist.
  2. For card sizes other than A5, edit the size value in @page, and the height and width properties of body.
  3. Add contents to each face. The simplest approach is to add an image called front.png of the same dimensions as the card.
  4. Generate a PDF from the HTML + CSS. If using Prince, it's as simple as prince index.html card.pdf.
  5. Take the PDF to a printer, and ask them to print as many copies as you need.
@hurie
hurie / setlocal.php
Last active March 13, 2024 05:52
Set locale for Indonesian on all platform (Windows, Linux and others Nix server)credit for buana95 at yahoo dot com
<?php
setlocale(LC_ALL,
'id_ID.UTF8', 'id_ID.UTF-8', 'id_ID.8859-1', 'id_ID',
'IND.UTF8', 'IND.UTF-8', 'IND.8859-1', 'IND',
'Indonesian.UTF8', 'Indonesian.UTF-8', 'Indonesian.8859-1', 'Indonesian', 'Indonesia',
'id', 'ID',
// Add english as default (if all Indonesian not available)
'en_US.UTF8', 'en_US.UTF-8', 'en_US.8859-1', 'en_US', 'American', 'ENG', 'English',
);
@jrmadsen67
jrmadsen67 / gist:bd0f9ad0ef1ed6bb594e
Last active August 19, 2024 10:37
Laravel Quick Tip: Handling CsrfToken Expiration gracefully
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if
a form sits there for a while (like a login form, but any the same) the csrf token in the form will
expire & throw a strange error.
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner.
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T!
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function.
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the
@wavezhang
wavezhang / java_download.sh
Last active November 13, 2024 02:42
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
@uyab
uyab / ganjil-genap.php
Created March 17, 2017 06:24
Print bilangan ganjil genap
<?php
$ganjil = $genap = [];
foreach (range(1, 100) as $angka) {
if ($angka % 2 == 0) {
$genap[] = $angka;
} else {
$ganjil[] = $angka;
}
}
@starlinq
starlinq / onedrive.md
Last active November 2, 2024 12:26
How to Sync Microsoft OneDrive with Ubuntu 18.04 and 20.04 (64 bit)
layout title tags date
post
How to Sync Microsoft OneDrive with Ubuntu 18.04 and 20.04 (64 bit)
ubuntu-18.04, ubuntu-20.04
2020-04-23

There are many instructions to syncronize your files with OneDrive cloud-based storage in Linux. However they typically address multiple Linux distributions that often causes a confusion or an use of some commands which have not been actually tested before publishing. This instruction is for Ubuntu 18.04 and 20.04 (64 bit) only.

In order to install onedrive, first you need to install some dependencies and set up git.

["#fd7f6f", "#7eb0d5", "#b2e061", "#bd7ebe", "#ffb55a", "#ffee65", "#beb9db", "#fdcce5", "#8bd3c7"]
["#115f9a", "#1984c5", "#22a7f0", "#48b5c4", "#76c68f", "#a6d75b", "#c9e52f", "#d0ee11", "#d0f400"]