Skip to content

Instantly share code, notes, and snippets.

View windwp's full-sized avatar
💭
I may be slow to respond.

windwp

💭
I may be slow to respond.
  • VietNam
View GitHub Profile
@windwp
windwp / file.js
Created July 18, 2016 01:26
Json fix for parse
s = s.replace(/\\n/g, "\\n")
.replace(/\\'/g, "\\'")
.replace(/\\"/g, '\\"')
.replace(/\\&/g, "\\&")
.replace(/\\r/g, "\\r")
.replace(/\\t/g, "\\t")
.replace(/\\b/g, "\\b")
.replace(/\\f/g, "\\f");
// remove non-printable and other non-valid JSON chars
s = s.replace(/[\u0000-\u0019]+/g, "");
@windwp
windwp / idle.py
Created June 13, 2016 09:06
fix hightlight error for typescript
line 164
view.add_regions(region_key, error_regions, "sublimelinter.underline.illegal", "dot",sublime.DRAW_SQUIGGLY_UNDERLINE)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ACPI</key>
<dict>
<key>SortedOrder-Comment</key>
<string>This is the original order supported by Clover prior to build v3062. You can trim it as necessary.</string>
<key>SortedOrder</key>
<array>
@windwp
windwp / capitalize.js
Last active June 11, 2016 08:45
javascript snippet
capitalize(value) {
return value.toLowerCase().replace( /\b\w/g, function (m) {
return m.toUpperCase();
});
}
@windwp
windwp / tabs.ts
Last active May 20, 2016 14:33
Ionic snippet
@ViewChild('rootTabs') tabRef:Tabs;
function emailValidator(control) {
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;
if (!EMAIL_REGEXP.test(control.value)) {
return {email: true};
}
}
@windwp
windwp / hyperv.bat
Created May 18, 2016 23:59
turn of hyper v
bcdedit /set hypervisorlaunchtype off
bcdedit /set hypervisorlaunchtype auto
@windwp
windwp / copy.cmd
Last active April 21, 2016 00:26
vmware mac os
SET "sourceDir=F:\workspace\build\IOS"
SET "destinationDir=D:\mac\share\IOS"
del "%sourceDir%\Libraries\libiPhone-lib.a"
for /d %%I in ("%destinationDir%\*") do (
if /i not "%%~nxI" equ "Libraries" rmdir /q /s "%%~I"
)
for /d %%I in ("%destinationDir%\Libraries\*") do (
const uint EVENT_SYSTEM_END = 0x00FF;
const uint EVENT_MIN = 0x00000001;
private void button1_Click(object sender, EventArgs e)
{
if (windowEventHook == IntPtr.Zero)
{
var threadId = 0;
var processId = Process.GetCurrentProcess().Id;
windowEventHook = SetWinEventHook(
var regex = /P((([0-9]*\.?[0-9]*)Y)?(([0-9]*\.?[0-9]*)M)?(([0-9]*\.?[0-9]*)W)?(([0-9]*\.?[0-9]*)D)?)?(T(([0-9]*\.?[0-9]*)H)?(([0-9]*\.?[0-9]*)M)?(([0-9]*\.?[0-9]*)S)?)?/
minutesFromIsoDuration = function(duration) {
var matches = duration.match(regex);
return parseFloat(matches[14]) || 0;
}
function youtube_parser(url) {
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
//angular 1x
app.angular.module('myApp', ['']);
app.controller('AppController', ['$scope', function($scope) {
}]);
app.service('DownloadService', ['$rootScope', function($rootScope) {
}]);