Skip to content

Instantly share code, notes, and snippets.

View attacomsian's full-sized avatar
🌱
Fore Studio

Atta ✨ attacomsian

🌱
Fore Studio
View GitHub Profile
@colebemis
colebemis / feather-pipe.ts
Created December 5, 2017 21:30
Using Feather with Angular
import { DomSanitizer } from '@angular/platform-browser';
import { Pipe, PipeTransform } from '@angular/core';
import { icons } from 'feather-icons'; // v4+
@Pipe({ name: 'feather' })
export class FeatherIconsPipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
@031nna
031nna / laravel-notes.md
Last active November 16, 2020 09:11
Common laravel commands

##laravel

logging in laravel

tail -n0 -F storage/logs/laravel.log add use Log; above the class then use Log::info('check this var =' . $var);

install laravel composer create-project laravel/laravel laravelapp

@saadtazi
saadtazi / app.js
Created July 19, 2016 11:52
passport multiple strategies
const express = require('express');
const cons = require('consolidate');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');
const session = require('express-session');
const passport = require('passport');
const FacebookStrategy = require('passport-facebook').Strategy;
const LocalStrategy = require('passport-local').Strategy;
const ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn;
@Sharabaddin
Sharabaddin / fastfix
Last active November 7, 2021 17:36
java.sql.SQLException: The server time zone value 'EEST' is unrecognized or represents more than one time zone
ERROR: java.sql.SQLException: The server time zone value 'EEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
SOLVE:
1. sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
2. add after line [mysqld]
default_time_zone='+03:00'
3. ctrl+o
4. ctrl+x
5. sudo service mysql restart
@jecyhw
jecyhw / AjaxAwareAuthenticationEntryPoint.java
Last active February 10, 2022 05:59
spring boot ajax session timeout
public class AjaxAwareAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint {
public AjaxAwareAuthenticationEntryPoint(String loginFormUrl) {
super(loginFormUrl);
}
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
String ajaxHeader = ((HttpServletRequest) request).getHeader("X-Requested-With");
if ("XMLHttpRequest".equals(ajaxHeader)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Ajax Request Denied (Session Expired)");
@mlvea
mlvea / currencies.json
Created March 17, 2015 16:07
Common currencies as an array
[
{
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@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;
}
@AndreiCalazans
AndreiCalazans / airlines.json
Last active August 1, 2023 11:38
List of Airlines 2 letter code
{
"U2": "easyjet",
"1T": "Bulgarian Air Charter",
"Q5": "40-Mile Air",
"4O": "Interjet",
"7A": "Express Air Cargo",
"JY": "Air Turks and Caicos",
"JU": "Air Serbia",
"QH": "Kyrgyzstan",
"A8": "Benin Golf Air",
@maheshwaghmare
maheshwaghmare / social-share-url-patterns.txt
Created May 13, 2017 09:54
Social Share URL Patterns. E.g. Facebook, Twitter, Google+, Pintrest, LinkedIn, Buffer, Digg etc.
Sharer : https://www.facebook.com/sharer.php?u={url}
Twitter : https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}
Google : https://plus.google.com/share?url={url}
Pinterest : https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}
LinkedIn : https://www.linkedin.com/shareArticle?url={url}&title={title}
Buffer : https://buffer.com/add?text={title}&url={url}
Digg : http://digg.com/submit?url={url}&title={title}
Tumblr : https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}
Reddit : https://reddit.com/submit?url={url}&title={title}
StumbleUpon : http://www.stumbleupon.com/submit?url={url}&title={title}
@gabrielbauman
gabrielbauman / CardType.java
Last active December 13, 2023 04:21
A Java enum representing credit card types (Visa, Mastercard etc) that can detect card type from a credit card number.
package com.gabrielbauman.gist;
import java.util.regex.Pattern;
public enum CardType {
UNKNOWN,
VISA("^4[0-9]{12}(?:[0-9]{3}){0,2}$"),
MASTERCARD("^(?:5[1-5]|2(?!2([01]|20)|7(2[1-9]|3))[2-7])\\d{14}$"),
AMERICAN_EXPRESS("^3[47][0-9]{13}$"),