Skip to content

Instantly share code, notes, and snippets.

View mishudark's full-sized avatar
:octocat:
Rocking

mishudark mishudark

:octocat:
Rocking
View GitHub Profile
@mishudark
mishudark / iconv
Created July 27, 2014 02:00
convert to utf8
iconv -f ISO-8859-1 -t UTF-8 input > output
package controllers
import (
//"encoding/json"
//"fmt"
"github.com/astaxie/beego"
"github.com/astaxie/beego/session"
"time"
)
package controllers
import (
"code.google.com/p/go.crypto/scrypt"
"github.com/astaxie/beego"
"github.com/astaxie/beego/session"
"net/http"
"regexp"
"time"
)
# Varnisch VCL file for the boundaries.minnpost.com site.
#
# Borrowed from http://ghughes.com/blog/2011/11/11/using-varnish-with-django-for-high-performance-caching/
# Default backend definition. Set this to point to your content
# server.
#
backend default {
r"function (?P<function>\w+Ctrl)\s?\((?P<arg>(?:[\w\$]+(?:,\s?)?)+)\)\s?(?:\n|\r\n)?\{((?:(?:\n|\r\n)?.*?))\}"
re.findall(regex,text,re.DOTALL|re.MULTILINE)
@mishudark
mishudark / Cake2-DboSource.patch
Created June 7, 2013 18:37
Get SQL from FIND model
diff --git a/core/lib/Cake/Model/Datasource/DboSource.php b/core/lib/Cake/Model/Datasource/DboSource.php
index 57368b4..f17a658 100755
--- a/core/lib/Cake/Model/Datasource/DboSource.php
+++ b/core/lib/Cake/Model/Datasource/DboSource.php
@@ -1026,7 +1026,7 @@ class DboSource extends DataSource {
* @param integer $recursive Number of levels of association
* @return mixed boolean false on error/failure. An array of results on success.
*/
- public function read(Model $model, $queryData = array(), $recursive = null) {
+ public function read(Model $model, $queryData = array(), $recursive = null, $sql = null) {
# Copyright (c) , mishudark <[email protected]>. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
import fileinput
import linecache
import re
file_css = 'style.css'
sprite_css = 'sprites.css'
var streetview = {
//overwrite with tag id
tag_container: 'map-street',
sv: null,
panorama: null,
init: function(){
this.sv = new google.maps.StreetViewService();
this.panorama = new google.maps.StreetViewPanorama(document.getElementById(this.tag_container));
},
//set position from LatLng google maps object
<input type="text" datepicker ng-model="myobj.myvalue" />
myApp.directive('myDatepicker', function ($parse) {
return function (scope, element, attrs, controller) {
var ngModel = $parse(attrs.ngModel);
$(function(){
element.datepicker({
...
onSelect:function (dateText, inst) {
@mishudark
mishudark / diff.js
Last active December 16, 2015 22:19
Angularjs filter: diff from 2 arrays
myApp.filter('diff',function(){
return function(input,differ){
if(!differ.length) return input;
var items = [];
angular.forEach(input,function(val){
if( !(val in differ) ){
items.push(val);
}
return items;