Skip to content

Instantly share code, notes, and snippets.

@aknosis
aknosis / gist:997144
Created May 28, 2011 19:32
Execute callback once when a google map is loaded (google maps api)
//Fill in the blanks :)
var map = new google.maps.Map(),
tileListener = google.maps.event.addListener(map,'tilesloaded',fixMyPageOnce);
function fixMyPageOnce(){
//immediately remove the listener (or this thing fires for every tile that gets loaded, which is a lot when you start to pan)
google.maps.event.removeListener(tileListener);
}
@chardcastle
chardcastle / deploy-static.ps1
Created June 1, 2011 22:48
Upload files (recursive) via powershell
## Automate FTP uploads
## Go to destination
cd C:\Test
$location = Get-Location
"We are here: $location"
## Get files
$files = Get-ChildItem -recurse
## Get ftp object
$ftp_client = New-Object System.Net.WebClient
$ftp_address = "ftp://user:pass@adress:/home/chardcastle/test"
@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 31, 2024 14:26 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@grantges
grantges / androidmanifestforpush.xml
Last active January 15, 2018 01:43
android manifest for push notification
<!--- REPLACE com.example.gcm WITH YOUR APP BUNDLE ID -->
<manifest package="com.example.gcm" ...>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
@staltz
staltz / introrx.md
Last active April 29, 2024 09:25
The introduction to Reactive Programming you've been missing
@jojobyte
jojobyte / ContextCmder-Disable.reg
Last active October 5, 2023 13:13
Cmder Context (Right-Click) Menu for Windows 7, 8, 10 & 11
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
[-HKEY_CLASSES_ROOT\Directory\shell\Cmder]
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@yanknudtskov
yanknudtskov / woocommerce-update-prices.sql
Last active August 1, 2023 23:45
Queries for updating all prices including variations in WooCommerceIn this instance all prices are subtracted 20% (0.8)#woocommerce #mysql
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_sale_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_regular_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_sale_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_price_tmp' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_min_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_max_variation_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHERE meta_key = '_min_variation_regular_price' AND meta_value != ''
UPDATE wp_postmeta SET meta_value = meta_value*0.8 WHE
@duluca
duluca / StartingWithDocker.md
Last active June 30, 2020 02:20
Starting with Docker

What is Docker?

  • Docker is an open platform for developing, shipping, and running applications.
  • Combines a lightweight container virtualization platform with workflows and tooling that help manage and deploy applications.

Why is Containerization Important?

  • Containerization allows for encapsulation of app specific configuration concerns.
  • Encapsulation allows for decoupling of dependencies, so each app can depend on different versions.
  • Simpler dependency management results in a low friction IT environment, less things to learn and break.
  • Low friction allows to ship code faster, test faster, deploy faster, shortening the cycle between writing code and running code.
@duluca
duluca / http-server.js
Created March 12, 2017 00:47
No plug-in http server for Node.js
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8080;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), "public", uri);