Skip to content

Instantly share code, notes, and snippets.

@fnk0
fnk0 / PaletteUtils.java
Created October 16, 2016 21:15
Helper class to extract the necessary palette colors from the generate palette
public class PaletteUtils {
public static PaletteColors getPaletteColors(Palette palette) {
PaletteColors colors = new PaletteColors();
//figuring out toolbar palette color in order of preference
if (palette.getDarkVibrantSwatch() != null) {
colors.setToolbarBackgroundColor(palette.getDarkVibrantSwatch().getRgb());
colors.setTextColor(palette.getDarkVibrantSwatch().getBodyTextColor());
colors.setTitleColor(palette.getDarkVibrantSwatch().getTitleTextColor());
@moshmage
moshmage / withinRadius.js
Last active April 18, 2022 09:22
compares two objects lat/lon and returns true if within provided kms
/**
* is One Point within Another
* @param point {Object} {latitude: Number, longitude: Number}
* @param interest {Object} {latitude: Number, longitude: Number}
* @param kms {Number}
* @returns {boolean}
*/
function withinRadius(point, interest, kms) {
'use strict';
@learncodeacademy
learncodeacademy / webpack.config.js
Created January 8, 2016 03:55
Sample Basic Webpack Config
var debug = process.env.NODE_ENV !== "production";
var webpack = require('webpack');
module.exports = {
context: __dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: "./js/scripts.js",
output: {
path: __dirname + "/js",
filename: "scripts.min.js"
@hollodotme
hollodotme / Install-php7.md
Last active August 11, 2022 06:23
Installing php7-fpm with phpredis and xdebug extension on Ubuntu 14.04

Install php7.0-fpm

# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
@crookedneighbor
crookedneighbor / github_without_symbols.js
Created September 25, 2015 19:10
Remove Minus and Plus Signs from Github PR Files Tab
// Open up a chrome console while viewing the files of a Github PR and paste this:
var deleted_nodes = document.querySelectorAll(".blob-code.blob-code-deletion .blob-code-inner");
var added_nodes = document.querySelectorAll(".blob-code.blob-code-addition .blob-code-inner");
var neutral_nodes = document.querySelectorAll(".blob-code.blob-code-context .blob-code-inner");
var removeNodes = function(nodes) {
for(var i=0; i < nodes.length; i++) {
nodes[i].removeChild(nodes[i].childNodes[0]);
}
@Malezha
Malezha / Centrifuge.php
Created August 25, 2015 20:23
Verifying access to channel
<?php
namespace App\Http\Controllers\Admin\API;
use App\Http\Controllers\Controller;
use App\Models\Channel;
use Illuminate\Http\Request;
class Centrifuge extends Controller
{
@danharper
danharper / CatchAllOptionsRequestsProvider.php
Last active April 20, 2024 01:53
Lumen with CORS and OPTIONS requests
<?php namespace App\Providers;
use Illuminate\Support\ServiceProvider;
/**
* If the incoming request is an OPTIONS request
* we will register a handler for the requested route
*/
class CatchAllOptionsRequestsProvider extends ServiceProvider {
@moonmilk
moonmilk / dreamhostpython.md
Last active August 12, 2022 16:15
trying to figure out useful info for running python on dreamhost shared hosting - intended for twitter bot makers

python for botmakers, on dreamhost shared hosting

On a shared hosting service like dreamhost, how do you get your twitter bot up and running? Problems:

  • where should I put my script?
  • you can't install python modules like tweepy (for twitter access) because you don't have root permission
  • once you get that solved, how do you run your script? cron?

I'm still figuring this stuff out myself, so nothing is clear as it should be. Hope this page will be a resource that will improve over time.

@nickpad
nickpad / cloudformation.json
Last active February 28, 2022 05:03
Example cloudformation template for auto scaling deploys
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Auto scaling deploy example",
"Parameters": {
"AvailabilityZone": {
"Type": "String",
"Default": "us-west-1a"
},
"ImageId": {
"Type": "String"
@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers