Skip to content

Instantly share code, notes, and snippets.

View sherwinwater's full-sized avatar
🎉

Shuwen sherwinwater

🎉
  • Canada
  • 18:48 (UTC -04:00)
View GitHub Profile
@tomcurran
tomcurran / Answer.php
Created April 9, 2012 19:13
PDO abstract model
<?php
class Answer extends ModelPDO {
public static function getAllByQuestion($question) {
return self::getAllBy('question_id', $question->id);
}
public function __construct($data = false) {
@joseluisq
joseluisq / terminal-git-branch-name.md
Last active June 14, 2024 19:05
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@TrevorJTClarke
TrevorJTClarke / BrowserDeviceInfo.js
Created September 1, 2015 17:52
A quick list of browsers and devices for use in testing. Chrome is used for all devices that need simulation.
var devices = [
{ name: 'Desktop - Huge', width: 2880, height: 1800, ratio: 2, type: 'desktop' },
{ name: 'Desktop - Extra Large', width: 1920, height: 1080, ratio: 1, type: 'desktop' },
{ name: 'Desktop - Large', width: 1440, height: 900, ratio: 1, type: 'desktop' },
{ name: 'Desktop - HiDPI', width: 1366, height: 768, ratio: 1, type: 'desktop' },
{ name: 'Desktop - MDPI', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with HiDPI screen', width: 1440, height: 900, ratio: 2, type: 'desktop' },
{ name: 'Laptop with MDPI screen', width: 1280, height: 800, ratio: 1, type: 'desktop' },
{ name: 'Laptop with touch', width: 1280, height: 950, ratio: 1, type: 'desktop' },
{ name: 'Tablet - Portrait', width: 768, height: 1024, ratio: 1, type: 'tablet' },
@elikem
elikem / AppMeasurement.js
Created December 16, 2015 17:00
AppMeasurement.js
/* Adobe Analytics
Marketing Reports & Analytics
Copyright 1996-2013 Adobe, Inc. All Rights Reserved */
s = new AppMeasurement();
s.account="outrainjjscit13site05,outrainjjscit13global"
/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here. */
s.charSet="UTF-8"
@henryscala
henryscala / mariadb_operation_example.c
Created March 16, 2018 02:30
mariadb or mysql prepared statements example using C API
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <mysql/mysql.h>
/*
The program is a demonstration of using prepared statements to perform operations on the below table in mariadb.
The statements include: insert, select, delete, etc.
CREATE TABLE person (
@niveshsaharan
niveshsaharan / JsColor.js
Last active March 13, 2022 04:01
React.js Component for jscolor.com
import React, { Component } from 'react';
import '../plugins/jscolor/jscolor';
/**
* JsColor
*/
class JsColor extends Component {
/**
* JsColor Constructor
* @param {*} props
@Ciantic
Ciantic / example-typeorm-jest.test.ts
Created April 16, 2019 17:50
Example of testing TypeOrm with Jest and Sqlite in-memory database
import { createConnection, getConnection, Entity, getRepository } from "typeorm";
import { PrimaryGeneratedColumn, Column } from "typeorm";
@Entity()
export class MyEntity {
@PrimaryGeneratedColumn()
id?: number;
@Column()
name?: string;
@nyx-code
nyx-code / FileUpload.js
Last active November 25, 2022 20:50
This NodeJS API which will upload files onto the AWS S3 Bucket. Video -> https://youtu.be/TtuCCfren_I
require('dotenv/config')
const express = require('express')
const multer = require('multer')
const AWS = require('aws-sdk')
const uuid = require('uuid/v4')
const app = express()
const port = 3000
@Hitesh822
Hitesh822 / select_list_items.dart
Last active March 19, 2022 16:15
Select List Items In Flutter
import 'package:flutter/material.dart';
void main() => runApp(SelectListItem());
class SelectListItem extends StatefulWidget {
@override
_SelectListItemState createState() => _SelectListItemState();
}
@aedorado
aedorado / docker-compose.yml
Created December 6, 2020 16:24
Docker compose file for ELK 7.9.2
version: '3.7'
services:
elasticsearch:
image: elasticsearch:7.9.2
ports:
- '9200:9200'
environment:
- discovery.type=single-node
ulimits: