Skip to content

Instantly share code, notes, and snippets.

View neilmenon's full-sized avatar

Neil Menon neilmenon

View GitHub Profile
@baart1989
baart1989 / observable-store.ts
Created May 4, 2020 09:17
Simple Angular - Redux connector
import { AnyAction, Store } from 'redux';
import { BehaviorSubject, Observable } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
import { Injectable } from '@angular/core';
import { NgZone } from '@angular/core';
export type Comparator = (x: any, y: any) => boolean;
/**
//AWS SDK 1.x.x
final PutObjectRequest putRequest = new PutObjectRequest(s3bucket, targetDirectory + “/” + file.getName(), file).withCannedAcl(CannedAccessControlList.PublicRead);
final Upload upload = transferManager.upload(putRequest);
//AWS SDK 2.0 — with ContentType
String fileType = Files.probeContentType(file);
final S3Client s3client;
s3client.putObject(PutObjectRequest.builder().bucket(s3bucket).key(targetDirectory + FileSystems.getDefault().getSeparator() + file.getFileName()).acl(ObjectCannedACL.PUBLIC_READ).contentType(fileType).build(),RequestBody.of(file));
@michaelkonecny
michaelkonecny / close_deleted_files.py
Created October 10, 2017 15:02
Sublime Text plugin - close tabs containing deleted files on refocus
"""
When a view is focused, goes through all open tabs and closes those, whose files don't exist anymore.
Tested in Sublime Text 3.0
"""
import sublime_plugin
import sublime
import time
import os
@tzmartin
tzmartin / embedded-file-viewer.md
Last active October 25, 2024 02:37
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@iturgeon
iturgeon / README.md
Last active October 30, 2023 14:06
How to run phpMyAdmin using the built in php webserver

Running phpMyAdmin localy on the built in php server

  1. make sure you have php 5.3+: run php -v
  2. Download phpmyadmin (github or main website)
  3. In the root directory, copy config.sample.inc.php > config.inc.php
  4. Edit config.inc.php, set $cfg['Servers'][$i]['host'] to the ip address of your mysql server (probably localhost or 127.0.0.1)
  5. In the root phpmyadmin directory run php -S localhost:8080
  6. open in your browser: http://localhost:8080
  7. log in by entering some valid credentials (a user you added or the root user)
@vitorbritto
vitorbritto / rm_mysql.md
Last active November 5, 2024 05:41
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@phoenixg
phoenixg / header_http_status_codes.php
Created April 6, 2013 14:02
PHP header() for sending HTTP status codes
<?php
/*
参考自:
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function
http://snipplr.com/view/68099/
*/
function HTTPStatus($num) {
$http = array(