Skip to content

Instantly share code, notes, and snippets.

@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" />
@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);
@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"
@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.
@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);
}
@RyanNutt
RyanNutt / isBase64.js
Created June 16, 2017 14:53
Check if a String is base64 encoded using JavaScript - from https://stackoverflow.com/a/34068497/1561431
function isBase64(str) {
try {
return btoa(atob(str)) == str;
} catch (err) {
return false;
}
}
@guillaumegarcia13
guillaumegarcia13 / sample.html
Created September 4, 2017 15:53
Angular 4 ng-template & ng-container with parameters
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge">
<div class="container-fluid">
<div class="card">
<div class="header">
<h4 class="title">{{ author }}</h4>
<p class="category">il y a {{ age }} jours</p>
</div>
<div class="content" [innerHTML]="text">
</div>
@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
@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]