Skip to content

Instantly share code, notes, and snippets.

@apisandipas
apisandipas / share-urls.md
Last active March 18, 2024 08:19 — forked from chrisjlee/drupal-views-share-global-text-field
Share url's for Facebook, Twitter, Pinterest and Linkedin with just get variables

Creating share buttons with just URL's

Twitter

http://twitter.com/share?text=<TITLE>&url=<URL>

E.g. http://twitter.com/share?text=This+is+google+a+search+engine&url=https%3A%2F%2Fwww.google.com

Facebook

http://www.facebook.com/sharer.php?u=&amp;p[title]=

@hyamamoto
hyamamoto / string.hashcode.js
Created September 30, 2016 07:19
JavaScript Implementation of String.hashCode() .
/**
* Returns a hash code for a string.
* (Compatible to Java's String.hashCode())
*
* The hash code for a string object is computed as
* s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
* using number arithmetic, where s[i] is the i th character
* of the given string, n is the length of the string,
* and ^ indicates exponentiation.
* (The hash value of the empty string is zero.)
@tomysmile
tomysmile / mac-setup-redis.md
Last active March 18, 2024 22:12
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@jarretmoses
jarretmoses / React Native Clear Cache
Last active March 11, 2024 10:20
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@obolton
obolton / elb-nodejs-ws.md
Last active November 12, 2023 11:49
Configuring an AWS Elastic Load Balancer for a Node.js application using WebSockets on EC2

AWS ELB with Node.js and WebSockets

This assumes that:

  • You are using Nginx.
  • You want to accept incoming connections on port 80.
  • Your Node.js app is listening on port 3000.
  • You want to be able to connect to your Node.js instance directly as well as via the load balancer.

####1. Create load balancer

@garystafford
garystafford / helpful-docker-commands.sh
Last active October 12, 2023 16:51
My list of helpful docker commands
###############################################################################
# Helpful Docker commands and code snippets
###############################################################################
### CONTAINERS ###
docker stop $(docker ps -a -q) #stop ALL containers
docker rm -f $(docker ps -a -q) # remove ALL containers
docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter
# exec into container
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@demisx
demisx / angularjs-providers-explained.md
Last active March 17, 2024 11:09
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant

@rotexdegba
rotexdegba / dropdown-list-in-a-cell-phpexcel.php
Created November 21, 2013 18:25
How to add drop down list to a cell in PHPExcel
<?php
$objValidation = $objPHPExcel->getActiveSheet()->getCell("C$curr_row")->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');
@Wu-Wu
Wu-Wu / haproxy.conf
Created June 29, 2013 14:44
HAProxy configuration to deploy PSGI application
#
# application entry points
# https://www.example.com/ (production)
# https://demo.example.com/ (demo/lite production)
# https://devel.example.com/ (development)
#
# static content served by nginx server
# http://app-be1.example.net:4xxx/
# http://app-be2.example.net:4xxx/
#