Skip to content

Instantly share code, notes, and snippets.

View udithishara's full-sized avatar
🏠
Working from home

Udith Ishara Madusanka udithishara

🏠
Working from home
View GitHub Profile
@ffxsam
ffxsam / Suspense.ts
Last active May 22, 2024 17:48
Vue 3's Suspense component, ready for use in Vue 2.x (TypeScript)
import Vue from 'vue';
export const Suspense = Vue.extend({
name: 'Suspense',
data: () => ({
resolved: false,
}),
async created() {
const setupMethod = (this.$parent as any).setup;
if (!setupMethod) {
@benfurfie
benfurfie / tailwind.config.js
Created July 17, 2019 20:27
Tailwind Default Config
module.exports = {
prefix: '',
important: false,
separator: ':',
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
@wdmtech
wdmtech / index.js
Created July 24, 2017 11:19
Facebook SDK (Graph/REST API) integration as a Vue.js mixin
export let facebookSDK = {
mounted () {
let _this = this
this.$nextTick(() => {
window.fbAsyncInit = function () {
FB.init({
appId: 'XXX',
xfbml: true,
version: 'v2.6'
})
@mindofjonas
mindofjonas / index.html
Created July 14, 2017 00:32
Vuejs SSFCRUD - Search Sort Filter Create Read Update Delete
<html lang="vi">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tôn Cường - The simple tutorial Vuejs</title>
<link rel="stylesheet" href="assets/css/normalize.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="assets/css/style.css">
@arsho
arsho / pdo_like.php
Created May 20, 2017 05:00
Like operator in PDO
<?php
$user = "root";
$password = "";
$name = "%o%";
try{
$conn = new PDO('mysql:host=localhost;dbname=test_db',$user,$password);
$query = "SELECT * FROM `test_table` WHERE `name` like :name";
$stmt = $conn->prepare($query);
$stmt->bindParam(':name',$name);
$stmt->execute();
@razbomi
razbomi / gulpfile.js
Created November 16, 2016 23:19
Gulp pipe function
'use strict';
var gulp = require('gulp');
var through = require('through2');
// https://gulp.readme.io/docs
gulp.task('default', () => {
gulp.src('src/**/*')
.pipe(pipeFunction())
.pipe(gulp.dest('dist'))
@mdang
mdang / PHP_PDO.md
Last active October 31, 2023 07:36
Lesson: PHP - PDO

PHP - PDO

Learning Objectives

  • Explain what PDO is and it's role in accessing data
  • Explain how to set up environment variables using PHP dotenv
  • Explain how to establish and destroy database connections
  • Describe what prepared statements are
  • Explain how to bind parameters to safely form SQL queries
  • Explain how to get the new ID generated from an insert statement
@nathansmith
nathansmith / [1] convertToMarkup.js
Last active November 16, 2023 12:43
Handy utilities for dealing with `<div contenteditable="true">` areas.
// Helpers.
import { convertToText } from './';
/*
You would call this when receiving a plain text
value back from an API, and before inserting the
text into the `contenteditable` area on a page.
*/
const convertToMarkup = (str = '') => {
return convertToText(str).replace(/\n/g, '<br>');
@mallocator
mallocator / wikipedia.custom.css
Last active March 23, 2024 08:45
Custom CSS to make wikipedia look a little more readable based on css styles of medium.com. Sizes work for me on a macbook and windows with 1080p display. Used with MonoBook preset in appearance preferences.
body {
padding: 0 10%;
}
p {
text-align: left;
font-size: 18px;
letter-spacing: 0.08px;
line-height: 26px;
word-wrap: break-word;
@cdnsteve
cdnsteve / facebook_user_likes_page_check.js
Created December 6, 2012 16:57
JavaScript: Facebook check if user likes page
/* Source: http://stackoverflow.com/questions/5093398/how-to-check-if-a-user-likes-my-facebook-page-or-url-using-facebooks-api
*/
function parsePageSignedRequest() {
if (isset($_REQUEST['signed_request'])) {
$encoded_sig = null;
$payload = null;
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
$sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));